A function for generating longitudinal data without missingness. All covariates (except for intercept) are normally distributed.
Usage
gee.generator(beta,samplesize,time,num.time.dep,num.time.indep,
rho,x.rho,dist,cor.str,x.cor.str)
Arguments
- beta
A vector containing underlying true coefficients for each covariate in the model (including the intercept).
- samplesize
The sample size.
- time
The number of observations per subject.
- num.time.dep
The number of time-dependent covariates.
- num.time.indep
The number of time-independent covariates (not include intercept).
- rho
The correlation coefficient for residuals across time.
- x.rho
The correlation coefficient for time-dependent covariates across time.
- dist
A specified distribution. It can be "gaussian", "poisson",and "binomial".
- cor.str
The correlation structure for residuals across time. It can be "independence","exchangeable", and "ar1".
- x.cor.str
The correlation structure for time-dependent covariates across time. It can be "independence","exchangeable", and "ar1".
Value
x: a matrix containing continuous covariates. The first column should contain all ones corresponding to the intercept.
y: a vector containing outcomes.
id: a vector indicating subject id.
Examples
beta<-c(-1,1,0.5,0)
samplesize<-100
geesimdata<-gee.generator(beta=beta,samplesize=samplesize,time=3,num.time.dep=2,
num.time.indep=1,rho=0.4,x.rho=0.2,dist="poisson",cor.str="exchangeable",
x.cor.str="exchangeable")
geesimdata$y
#> [1] 2 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1
#> [38] 0 0 0 0 0 2 0 0 0 3 0 0 0 1 1 2 3 0 0 0 2 2 2 1 0 1 1 1 1 0 0 0 1 1 2 1 1
#> [75] 0 0 0 1 1 0 0 0 0 3 0 1 1 2 2 7 0 0 1 3 1 2 0 0 0 0 0 0 0 3 0 0 0 0 2 3 0
#> [112] 0 1 0 4 0 2 2 0 0 6 1 0 0 4 0 0 1 0 0 1 4 0 1 0 1 0 0 0 0 0 0 1 1 3 0 2 0
#> [149] 0 0 0 0 0 0 2 2 1 1 0 0 0 0 0 0 2 2 1 0 1 0 1 1 0 0 1 0 1 2 0 0 0 0 0 0 7
#> [186] 0 1 0 1 0 0 0 0 0 0 0 1 0 7 1 0 2 5 6 0 0 0 1 0 2 0 0 1 0 0 0 1 1 0 1 0 0
#> [223] 0 1 4 1 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 1 1 0 0 0 1 0 0 0 0 5 2 1 3 0 0 0 0
#> [260] 2 0 0 0 0 3 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 3 1 0 0 0 3 1 1 0 0 3 3 1 2 0 0
#> [297] 0 3 2 0