Calculating median or geometric mean from the posterior samples of a lognormal model

How to calculate y variable median or geometric mean from the posterior samples of a lognormal model? I’ll provide a simple example.

Data

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)

Distribution of y variable
000003
Crude geometric mean was calculated as follows: exp(mean(log(df$y)))

Model

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

Automatic posterior transformation functions
Seem to be based on arithmetic mean, which is not suitable for reporting with such distribution (being almost two times higher compared to the median, therefore biasing the “reality” or actual life (more dependent on extreme values))

    fitted(m)
    posterior_epred(m)

Estimate = 11.87025
Estimate = 11.87025

Posterior samples

    posterior_samples(m)

psoterior2
Transforming posterior samples values manually
I am not sure if this is correct. I have seen that some times exponentiation gives median and sometimes geometric mean.

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

psoterior3

QUESTION
Is the underlined value the median or geometric mean of y, or something else? If something else, how can I calculate a median and/or a geometric mean?

Gmedian::Gmedian(exp(as.data.frame(m)$b_Intercept))
2 Likes