Skip to contents

Fit response-column-specific random intercepts and/or slopes with an IID source across response columns. The coefficient matrix has covariance I across response columns and a fitted full (|) or diagonal (||) covariance across the coefficient basis.

Usage

column_coef(formula)

Arguments

formula

A coefficient-basis bar expression such as 1 + x | trait, 0 + x | trait, or 1 + x || trait.

Value

A formula marker; never evaluated directly.

Details

This point-model route is covered for Gaussian multivariate data in long or traits(...) wide form, with bare numeric row predictors. Non-Gaussian coefficient models and interval inference are not available in this release. phylo_coef() and animal_coef() are the pedigree/tree sources; kernel_coef() supplies a labelled dense kernel; and spatial_coef() supplies a labelled response-column mesh.

Examples

set.seed(1)
dat <- expand.grid(unit = factor(1:10), trait = factor(paste0("sp", 1:3)))
dat$x <- rnorm(10)[dat$unit]
dat$value <- rnorm(nrow(dat))
fit <- gllvmTMB(value ~ 1 + column_coef(0 + x | trait), data = dat,
  trait = "trait", unit = "unit", family = gaussian(),
  control = gllvmTMBcontrol(se = FALSE), silent = TRUE)
extract_Sigma(fit, level = "column_coef")
#> $Sigma
#>           x
#> x 0.2465323
#> 
#> $R
#>   x
#> x 1
#> 
#> $level
#> [1] "column_coef"
#> 
#> $part
#> [1] "dep"
#> 
#> $basis
#> [1] "x"
#> 
#> $source
#> $source$type
#> [1] "iid"
#> 
#> $source$grouping
#> [1] "trait"
#> 
#> $source$labels
#> [1] "sp1" "sp2" "sp3"
#> 
#> 
#> $rho
#> NULL
#> 
#> $rho_status
#> [1] "not_applicable"
#> 
#> $K_rho
#> NULL
#> 
#> $note
#> [1] "Response-column coefficient covariance; the response-column source supplies the other Kronecker factor."
#>