Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/powslopes_new2.R View source: R/powslopes_new1.R
Computes the variance covariance matrix of an m vector which results from a random effects model.
1 | randomEffectsMatrix(zMatrix, vs, sigma2)
|
zMatrix |
An m X p design matrix which specifies how p random variables with zero mean are linearly related to the m-dimensional normal vector. |
vs |
The p X p variance covariance matrix of the random effects, |
sigma2 |
The error variance. |
We assume that y_{t}=μ_t+Σ γ_j z_{t,j}+σ^2 ε,
where γ_j are random variables with mean 0 and and variance covariance vs
, and z is zMatrix
, ε is a standard normal random variable.
The zMatrix
could be a list of matricies
Either a single variance covariance matrix or a list of them if zMatrix is a list.
David A. Schoenfeld
1 2 3 4 5 6 7 8 9 10 11 12 | #Creates random variance covariance matrix for random follow up model
#where baseline is random among patients and all follow up have a compound symetry structure
#from a common random effect
vars=randomEffectsMatrix(cbind(rep(1,5),matrix(c(0,rep(1,4)),5,1)),
matrix(c(31.8,.8527,.8527,.6687),2,2),2.7085)
LPower(sample_size=40,power=.8,
xMatrix=list(cbind(1,c(0,rep(1,4)),0),cbind(1,c(0,rep(1,4)),c(0,rep(1,4)))),vMatrix=vars)
#Creates random variance covariance matrix for random slopes model
vars=randomEffectsMatrix(cbind(rep(1,5),0:4),
matrix(c(31.8,.8527,.8527,.6687),2,2),2.7085)
LPower(sample_size=40,power=.8,
xMatrix=list(cbind(1,0:4,0),cbind(1,0:4,0:4)),vMatrix=vars)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.