Adds slope-only response-column deviations coupled by a supplied labelled
covariance matrix K. With response-column by predictor coefficient
matrix B, the model is
$$\mathrm{Cov}(\mathrm{vec}(B^\mathsf{T})) = K \otimes \Sigma.$$
A single | estimates a full predictor covariance Sigma; || makes it
diagonal. For one predictor these are the same model. K must be finite,
symmetric, positive definite, and have row and column names matching the
levels of the response-column factor. Its storage order need not match the
factor order because labels are used for alignment.
Details
Scope
This route is covered for one labelled positive-definite kernel, Gaussian long-format data, and one or more bare, finite numeric predictors. The supplied matrix is used on its original scale. Wide-format column slopes, non-Gaussian responses, transformed/factor bases, and a random intercept inside this term are not supported in this release.
Examples
if (FALSE) { # \dontrun{
set.seed(1); dat <- expand.grid(unit = factor(1:12), trait = factor(paste0("sp", 1:4)))
dat$lat <- rnorm(nrow(dat)); dat$temp <- rnorm(nrow(dat)); dat$value <- rnorm(nrow(dat))
K <- diag(nlevels(dat$trait)); dimnames(K) <- list(levels(dat$trait), levels(dat$trait))
fit <- gllvmTMB(
value ~ 0 + trait + kernel_slope(lat + temp | trait, K = K),
data = dat, trait = "trait", unit = "unit",
family = gaussian()
)
extract_Sigma(fit, level = "column_slope")
} # }
