LogLinkSpec.mean_correction#
- LogLinkSpec.mean_correction(posterior, output_var='y')[source]#
Return
exp(sigma**2 / 2), the LogNormal mean/median ratio.For
y \sim \text{LogNormal}(\mu, \sigma)the conditional median isexp(mu)while the conditional mean isexp(mu + sigma**2 / 2). The ratioexp(sigma**2 / 2)therefore rescales a median-based quantity to the mean.- Raises:
ValueErrorIf the likelihood scale
f"{output_var}_sigma"is not present in the posterior (e.g. a fixed-sigma likelihood), so the mean correction cannot be computed.