So it seems that the “identity” link in brms
’ lognomal
family isn’t actually an identity link (that is, E[y|X]\neq bX, but instead E[log(y)|X] = bX:
library(brms)
mlognorm <- brm(mpg ~ hp + wt,
family = lognormal(link = "identity"),
data = mtcars)
mnorm_log <- brm(log(mpg) ~ hp + wt,
family = gaussian(),
data = mtcars)
parameters::model_parameters(mlognorm, test = NULL)
#> Parameter | Median | 95% CI | Rhat | ESS
#> ----------------------------------------------------------
#> (Intercept) | 3.83 | [ 3.68, 3.96] | 1.001 | 1385.00
#> hp | -1.52e-03 | [ 0.00, 0.00] | 1.000 | 1458.00
#> wt | -0.20 | [-0.26, -0.15] | 1.001 | 1167.00
parameters::model_parameters(mnorm_log, test = NULL)
#> Parameter | Median | 95% CI | Rhat | ESS
#> ----------------------------------------------------------
#> (Intercept) | 3.83 | [ 3.68, 3.96] | 1.001 | 1379.00
#> hp | -1.57e-03 | [ 0.00, 0.00] | 0.999 | 1684.00
#> wt | -0.20 | [-0.26, -0.15] | 1.000 | 1199.00
I would say that the calling this an identity-link is (1) misleading, and (2) this means we aren’t modeling E[Y] but E[log(Y)], which I am uneasy about.
Is there a way to have actually model a linear relationship between X and Y with Y being conditionally lognormally distributed using brms
?