Learn R Programming

SteppedPower (version 0.1.0)

construct_CovSubMat: 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,
  tauAR = NULL,
  etaAR = NULL,
  rho = NULL,
  gamma = 0,
  trtMat = 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

tauAR

numeric (scalar), value between 0 and 1. Defaults to NULL. If `tauAR` is not NULL, the random intercept `tau` is AR1-correlated. *Currently not compatible with `rho`!=0 !*

etaAR

numeric (scalar), value between 0 and 1. Defaults to NULL. If `etaAR` is not NULL, the random slope `eta` is AR1-correlated. *Currently not compatible with `rho`!=0 !*

rho

numeric (scalar), correlation of `tau` and `eta`

gamma

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

trtMat

a matrix of dimension *#Cluster* x *timepoints* as produced by the function `construct_trtMat`, indicating the cluster-periods that receive interventional treatment. Defaults to NULL. If trtMat is given, the arguments `SumCl` and `timepoints` are ignored (!).

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