View source: R/construct_DesMat.R
construct_DesMat | R Documentation |
Constructs the design matrix with one column for every (fixed) parameter to be estimated and one row for every cluster for every timepoint. This function calls 'construct_trtMat' to construct a matrix that indicates treatment status for each cluster at each timepoint. This is then transformed into the first column of the design matrix. 'construct_CovMat' further calls 'construct_timeAdjust' to get the fixed effect(s) of the timepoints.
Note: Unlike the usual notation, the treatment effect is in the first column (for easier access by higher level functions).
construct_DesMat(
Cl = NULL,
trtDelay = NULL,
dsntype = "SWD",
timepoints = NULL,
timeAdjust = "factor",
period = NULL,
trtmatrix = NULL,
timeBlk = NULL,
N = NULL,
incomplete = NULL,
INDIV_LVL = FALSE
)
Cl |
integer (vector), number of clusters per sequence group (in SWD), or number in control and intervention (in parallel designs) |
trtDelay |
numeric (possibly vector), 'NA'(s) and/or value(s) between '0' and '1'. 'NA' means that first (second, ... ) period after intervention start is not observed. A value between '0' and '1' specifies the assumed proportion of intervention effect in the first (second ... ) intervention period. |
dsntype |
character, defines the type of design. Options are "SWD", "parallel" and "parallel_baseline", defaults to "SWD". |
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. |
timeAdjust |
character, specifies adjustment for time periods. One of the following: "factor", "linear", "none", "periodic". Defaults to "factor". |
period |
numeric (scalar) |
trtmatrix |
an optional user defined matrix to define treatment allocation |
timeBlk |
an optional user defined matrix that defines the time adjustment in one cluster. Is repeated for every cluster. |
N |
numeric, number of individuals per cluster. Either a scalar, vector of length #Clusters or a matrix of dimension #Clusters x timepoints. Defaults to 1 if not passed. |
incomplete |
integer, either a scalar (only for SWD) or a matrix. A vector defines the number of periods before and after the switch from control to intervention that are observed. A matrix consists of '1's for observed clusterperiods and '0's or 'NA' for unobserved clusterperiods. |
INDIV_LVL |
logical, should the computation be conducted on an individual level? This leads to longer run time and is mainly for diagnostic purposes. |
an object of class DesMat
construct_DesMat(Cl=c(2,0,1))
construct_DesMat(Cl=c(2,0,1), N=c(1,3,2))
## manually defined time adjustment (same as above)
timeBlock <- matrix(c(1,0,0,0,
1,1,0,0,
1,0,1,0,
1,0,0,1), 4, byrow=TRUE)
construct_DesMat(Cl=c(2,0,1), timeBlk=timeBlock)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.