Skip to contents

Adds slope-only deviations across the response columns of a long-format Gaussian model. If B is the response-column by predictor coefficient matrix and Sigma is the fitted covariance among its predictor columns, this helper uses $$\mathrm{Cov}(\mathrm{vec}(B^\mathsf{T})) = I \otimes \Sigma.$$ Write x1 + x2 | trait for a full predictor covariance or x1 + x2 || trait for a diagonal predictor covariance. Both spellings give the same one-variance model when there is only one predictor. The term never adds a random intercept; keep response-column intercepts in the main formula with 0 + trait.

Usage

slope(formula)

Arguments

formula

A slope-only bar formula with bare numeric predictor names on the left and the resolved response-column factor on the right, for example x | trait or x1 + x2 || trait.

Value

A formula marker; never evaluated.

Details

Scope

This route is covered for Gaussian long-format data with one or more bare, finite numeric predictors. 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))
fit <- gllvmTMB(value ~ 0 + trait + slope(lat + temp | trait), data = dat,
  trait = "trait", unit = "unit", family = gaussian())
extract_Sigma(fit, level = "column_slope")
} # }