# Lognormal model: reporting median or geometric mean

I have a bayesian lognormal model as follows (brms package):

m = brm(y ~ 1, data = df, family = lognormal)

Model was run with default priors.

This is model's posterior samples on lognormal scale

posterior_samples(m)

Is exponentiated b_Intercept the median or geometric mean of y variable?

I have seen that some websites say that this is a geometric mean, some refer to this as a median. Or if this is something different, could you please provide a formula for calculating geometric mean or median from this posterior?

posterior_samples(m) %>%
mutate(transformed = exp(b_Intercept)) %>%
posterior_summary() %>% as.data.frame()

Crude median, mean and geometric mean of Y for comparison

Crude geometric mean was calculated as follows: exp(mean(log(df\$y)))

Data used

set.seed(0)
pi <- 0
mu_log <- 2
sigma_log <- 0.99
N = 1000
y = (1 - rbinom(N, 1, prob = pi)) * rlnorm(N, mu_log, sigma_log)
df = data.frame(y=y)

This is tricky. The link function for brms' lognormal is the identity link by default. This means that the underlying Stan model codes the likelihood as mu = Intercept; target += lognormal_lpdf(Y | mu, sigma);, which is leads to an estimate of the median on the log scale. Thus, exp(b_Intercept) should me the median. This is supported by a small example:

set.seed(0)
N = 10000
y = rlnorm(N, 0.5, 0.5)

d = tibble(y)

model = brm(y~1, family = lognormal(), data = d)

median(y)
>>>1.655619

model %>%
As for the difference between geometric mean and median, it seems that the geometric mean for the lognormal is $$\exp(\mu)$$ which is the median. The difference between your estimate and your model's estimate could be due to regularization by the priors, but I can't be sure Are you willing to post the data?