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**

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)
```

**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()
```

**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?