Learn R Programming

samplingDataCRT (version 1.0)

sampleData: Sampling Response of individuals within a SWD model

Description

Sample data (response) for given numbers of individuals by given a model (of a parallel, cross-sectional, stepped wedge design study)

Usage

sampleData(type, K, J, I, D, A = NULL, V, parameters)

Arguments

type
of the design is either cross-sectional (cross-sec) or longitudinal (longitudinal)
K
number of timepoints or measurments (design parameter)
J
number of subjects
I
number of clusters (design parameter)
D
a complete data design matrix corresponding to the assumed model
A
a complete data design matrix corresponding to the true data, if A is null, then A is equal to D
V
covariance matrix for the normal distribution
parameters
corresponding to the model (regression fixed effects coefficients)

Value

Data of individuals intensities corresponds to the SWD model and full model parameter information

Examples

Run this code
K<-6  #measurement (or timepoints)
I<-10 #Cluster
J<-2 #number of subjects
X<-designMatrix(nC=I, nT=K, nSw=2)
D<-completeDataDesignMatrix(J, X)
sigma.1<-0.1
sigma.3<-0.9
type<-"cross-sec"
V<-CovMat.Design(K, J, I, sigma.1=sigma.1, sigma.3=sigma.3)
mu.0<-0
theta<-1
betas<-rep(0, K-1)
parameters<-c(mu.0, betas, theta)
sample.data<-sampleData(type = type, K=K,J=J,I=I, D=D, V=V, parameters=parameters)
xtabs(~cluster+measurement, data=sample.data)

Run the code above in your browser using DataLab