Learn R Programming

SimTimeVar (version 1.0.0)

Simulate Longitudinal Dataset with Time-Varying Correlated Covariates

Description

Flexibly simulates a dataset with time-varying covariates with user-specified exchangeable correlation structures across and within clusters. Covariates can be normal or binary and can be static within a cluster or time-varying. Time-varying normal variables can optionally have linear trajectories within each cluster. See ?make_one_dataset for the main wrapper function. See Montez-Rath et al. for methodological details.

Copy Link

Version

Install

install.packages('SimTimeVar')

Monthly Downloads

148

Version

1.0.0

License

GPL-2

Maintainer

Maya Mathur

Last Published

September 30th, 2017

Functions in SimTimeVar (1.0.0)

has_drug_suffix

Checks whether string has "_s" suffix
make_one_dataset

Simulate time-varying covariates
wcor

An example within-cluster correlation dataframe
expand_matrix

Longitudinally expand a matrix of single observations by cluster
expand_subjects

Longitudinally expand a cluster
make_one_linear_pred

Generate linear predictor from logistic model
mod.jointly.generate.binary.normal

Return closest value
override_static

Override static variable
override_tbin_probs

Override probabilities for time-varying binary variables
add_one_categorical

Generate linear predictor from logistic model
proportionize

Turn a number into a valid proportion
upper_tri_vec

Turn symmetric matrix into vector
BN.rBound

Maximum correlation between binary and normal random variables
params

An example parameters dataframe
pcor

An example across-cluster correlation dataframe
closest

Return closest value
complete_parameters

Fill in partially incomplete parameters matrix
add_time_function_vars

Creates linear time-function variables
cat.params

An example dataframe for categorical variable parameters