# sampleData: Sampling Response of individuals within a SWD model In samplingDataCRT: Sampling Data Within Different Study Designs for Cluster Randomized Trials

## Description

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

## Usage

 `1` ```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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```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) ```

samplingDataCRT documentation built on May 2, 2019, 9:25 a.m.