CS: Compound Symmetry Structure

View source: R/structure.R

CSR Documentation

Compound Symmetry Structure

Description

Variance-covariance structure where the variance and correlation of the residuals is constant within covariate levels. Can be stratified on a categorical variable. The default has no covariate and therefore the variance and correlation are constant within cluster.

Usage

CS(formula, var.cluster, var.time, type = NULL, group.type = NULL, add.time)

Arguments

formula

formula indicating on which variable to stratify the residual variance and correlation (left hand side) and variables influencing the residual variance and correlation (right hand side).

var.cluster

[character] cluster variable.

var.time

[character] time variable.

type

[character]

  • "ho", "homo", or "homogeneous": constant variance and covariate-specific correlation. Analogous to crossed or nested random effects.

  • "he", "hetero", or "heterogeneous": variance and correlation specific to the level of covariates. Can be seen as more flexible crossed or nested random effects model.

group.type

[integer vector] grouping of the regressor for the correlation structure. A constant value corresponds to nested random effects (default) and a regressor-specific value to crossed random effects

add.time

not used.

Details

A typical formula would be ~1, indicating a variance constant over time and the same correlation between all pairs of times.

Value

An object of class CS that can be passed to the argument structure of the lmm function.

Examples

## no covariates
CS(~1, var.cluster = "id", var.time = "time")
CS(gender~1, var.cluster = "id", var.time = "time")

## covariates
CS(~time, var.cluster = "id", var.time = "time")
CS(gender~time, var.cluster = "id", var.time = "time")
CS(list(~time,~1), var.cluster = "id", var.time = "time")
CS(list(gender~time,gender~1), var.cluster = "id", var.time = "time")


LMMstar documentation built on Nov. 9, 2023, 1:06 a.m.