gee.generator: Generate longitudinal data without missingness

View source: R/supporting_functions.R

gee.generatorR Documentation

Generate longitudinal data without missingness

Description

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


ELCIC documentation built on Feb. 16, 2023, 7:18 p.m.