construct_CovSubMat: Construct a Block of the Covariance Matrix

View source: R/construct_CovMat.R

construct_CovSubMatR Documentation

Construct a Block of the Covariance Matrix

Description

Constructs the covariance matrix for multiple measurements of the same cluster if the same individuals are observed at all time periods. This function is not designed to be used directly.

Usage

construct_CovSubMat(
  N,
  timepoints,
  sigma,
  tau,
  eta = NULL,
  AR = NULL,
  rho = NULL,
  gamma = NULL,
  psi = NULL,
  INDIV_LVL = FALSE
)

Arguments

N

Number of individuals per cluster

timepoints

numeric (scalar or vector), number of timepoints (periods). If design is swd, timepoints defaults to length(Cl)+1. Defaults to 1 for parallel designs.

sigma

numeric (vector of length 'timepoints'), residual error

tau

numeric (vector of length 'timepoints'), standard deviation of random intercepts

eta

numeric (vector of length 'timepoints'), standard deviation of random slope

AR

numeric, vector containing up to three values, each between 0 and 1. Defaults to NULL. It defines the AR(1)-correlation of random effects. The first element corresponds to the cluster intercept, the second to the treatment effect and the third to subject specific intercept. If only one element is provided, autocorrelation of all random effects is assumed to be the same. *Currently not compatible with 'rho'!=0 !*

rho

numeric (scalar), correlation of 'tau' and 'eta'. The default is no correlation.

gamma

numeric (vector of length 'timepoints'), standard deviation of a random time effect.

psi

numeric (scalar), random subject specific intercept. Leads to a closed cohort setting

INDIV_LVL

logical, should the computation be conducted on an individual level? This leads to longer run time and is mainly for diagnostic purposes.

Value

a block of a covariance matrix with two levels of clustering, corresponding to intra-cluster covariance over time for one cluster


PMildenb/SteppedPower documentation built on Sept. 20, 2023, 4:57 a.m.