dataexamples {gesttools}R Documentation

Generate Simulated Example Datasets

Description

The code simulates four datasets designed to demonstrate the g-estimation functions of the package. These are used in the examples in the user manual. Each dataset comprises of an outcome Y (time-varying or end of study), time-varying exposure A, time-varying confounder L, a baseline confounder U, and optionally a censoring indicator C over 3 time periods.

Usage

dataexamples(n = 1000, seed = NULL, Censoring = FALSE)

Arguments

n

Number of individuals in the dataset.

seed

Random seed used for data generation.

Censoring

TRUE or FALSE indicator of whether to include a censoring indicator C. If Censoring=TRUE, data entries for A, Y, L and U are set to missing after censoring.

Value

Returns a list of four datasets labeled datagest, datagestmult, datagestcat, and datagestmultcat, designed to demonstrate an end of study outcome with a binary exposure (datagest), a time varying outcome study with a binary exposure (datagestmult), or an end of study or time varying outcome with a categorical exposure (datagestcat or datagestmultcat).

Examples

datas <- dataexamples(n = 1000, seed = 34567, Censoring = FALSE)
data <- datas$datagest
head(data, n = 20)
# Multiple outcome data with censoring
datas <- dataexamples(n = 100, seed = 34567, Censoring = TRUE)
data <- datas$datagestmultcat
head(data, n = 20)

[Package gesttools version 1.3.0 Index]