Structured covariates in mixed regression models using arms

I have a question regarding the brms package.

I am studying structured random effects, and therefore utilizing INLA in my analysis. However, I wanted to investigate wether or not Variational Bayesian methods could compete. My dataset has a precision matrix for the random effects, that is calculated based on the relation that the birds in the dataset (relatedness matrix A). It is therefore assumed that the random effects follow a normal distribution with 0 mean and the variance-covariance being the quantity of interest multiplied with this relatedness matrix. I would like to incorporate this into the brms fit, but I cannot find any documentation as to how one would proceed. Does the brms package have the capability to include structured random effects like this?

Currently I have some code for the modelling that does not take the relatedness into account, here it is:

get_prior(mass ~ sex + FGRM + month + age + outer + other
            + (1|IDC2),
          data = d.morph_transformed, family = gaussian())


prior1 <- prior("norm", c(mean = 0, sd = .3))
fit1 <- brm(mass ~ sex + FGRM + month + age + outer + other
            + (1|IDC2), data = d.morph_transformed,
            family = gaussian(), prior = prior1)


prior_coefficient <- prior_string("normal(0, 0.3)", class = "b")

# For the standard deviations of the group-level effects (random effects)
(prior_sd <- prior_string("student_t(3, 0, 2.5)", class = "sd"))

# Combine all priors
combined_priors <- c(prior_coefficient, prior_sd)

# Fit the model
fit1 <- brm(
  formula = mass ~ sex + FGRM + month + age + outer + other +(1|IDC2), 
  data = d.morph_transformed,
  family = gaussian(), # Changed to gaussian() based on get_prior() output; adjust if necessary
  prior = combined_priors
)
fit1
plot(fit1)

where I have the relatedness matrix for the covariate IDC2.

Oh and if anyone has any tips on fun topics to check out regarding VB analysis compared to/in combination with INLA on the same topic, I am very interested as I am writing my masters thesis.

Thanks in advance for any response :)

It sounds like you are estimating a quantitative genetic “animal model”. You can do:

brm(
  mass ~ sex + FGRM + month + age + outer + other + (1 | gr(IDC2, cov = A)), 
  data = d.morph_transformed, data2 = list(A = Amat),
  family = gaussian(), prior = combined_priors
)

where Amat is your relatedness matrix. See the phylogenetics vignette.

2 Likes