G-priors in brms

Dear brms community,
I am trying to convey g-prior specification for the variance components in an hierarchical linear model (Y~A * B+(A * B|Sub)) with brms but I can’t find any guidance about. All I found is this thread and this this discussion on github. Does anyone have any insights about it?

Thanks:)

What exactly would you like insight on? It looks like the problem was solved on the github page with the example provided being:

<define csq and V in R>
prior <- set_prior("multi_normal(0, sigma^2 * csq * V)")
stanvars <- stan_var(csq) + stan_var(V)
fit <- brm(y ~ x, data, prior = prior, stan_vars = stanvars)

It seems like all you need to do is define csq and V as objects in R (e.g., csq <- ...), specify the prior(s) as shown, and then declare csq and V as Stan variables that get passed to the brm(...) call

Yes well, I thought this solution is relevant only for multivariate models. Good to know I got it wrong then, thank you :)

I see. To be fair, I’ve never used a g-prior before, so I don’t know the intricacies here. At least in the example from github, it looks like the model is not multivariate (e.g., the formula is just y ~ x)

1 Like