# Modeling sigma in brms using mean

Is it possible to have brms do the following model:

in pseudocode:

y ~ N(exp(log_mu), exp(log_sigma))
log_mu = X * Beta
log_sigma = alpha0 + alpha1 * log_mu

clearly the log link on the mean and variance is easy and well documented but I wasn’t sure if I was able to utilize the mean in predicting the variance.

I think you can achieve this readily though the nonlinear modeling syntax in brms. Do the examples here clarify the way forward?
https://cran.r-project.org/web/packages/brms/vignettes/brms_nonlinear.html

1 Like

Btw, I’ve found location-scale models tend to behave better when modelling the log-variance (rather than log-sd as you have).

Isn’t the log variance just exactly twice the log sd, which would just rescale the coefficients?

Lol, I never realized that, but of course! 🤦‍♂️ I guess my “better behaved” anecdote is spurious

2 Likes

Thanks that’s what I needed

Oh wait! I just remembered why I like log-variance; because then a std_normal() prior has a nice pushforward density for the standard deviation: