I’m trying to understand the multivariate model formula implied by fit3
from the brms
vignette on multivariate models. To bring everything into one place from that vignette, that model can be reproduced by running the following:
library(brms)
data("BTdata", package = "MCMCglmm")
bf_tarsus <- bf(tarsus ~ sex + (1|p|fosternest) + (1|q|dam)) +
lf(sigma ~ 0 + sex) +
skew_normal()
bf_back <- bf(back ~ s(hatchdate) + (1|p|fosternest) + (1|q|dam)) +
gaussian()
fit3 <- brm(
bf_tarsus + bf_back + set_rescor(FALSE),
data = BTdata, chains = 2, cores = 2,
control = list(adapt_delta = 0.95)
)
If I’m following the narrative & syntax correctly, this model implies correlations between parameters in the tarsus
and back
components of the multivariate model. Specifically, the “random” effects of fosternest
and dam
are correlated among model components and are linked by |p|
and |q|
, respectively. Using the fitted coefficients and the prior summary tables,
summary(fit3)
prior_summary(fit3)
I think the formula notation should be something like*:
My questions:
1. Is this the correct correlation structure implied by the brms
model syntax in the vignette? I’ve largely followed this example from Solomon’s Statistical Thinking Recoded.
2. How should the GAMM smooth term be expressed in the formula? I’m especially unsure about how to express (a) the population-level effect for back_shatchdate_1
that appears in the model summary table and (b) the additive term for class sds
. What you see in the formula above is what I managed to (feebly) adapt from Crainiceanu et al. (2005) J Stat Soft.
3. Is there a way to adapt this model to infer the number of knots (K
) for the smooth term? I’d be interested in both the brms
and formula syntax to accomplish this.
I’m grateful for any help you’re able to offer.
*Notation: I’ve substituted \vartheta in for the shape parameter of the skew normal distribution (usually called \alpha). Superscripts on model parameters refer to ^t tarsus and ^b back, respectively.
- Operating System: OSX 10.14.6
- brms Version: 2.11.6