Skip to content
Simulation results for "Assessing Time-Varying Causal Effect Moderation in Mobile Health"
R C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
example.R
example.Rout
example_geepack.R
example_geepack.Rout
init.R
rsnmm.R
rsnmm.c
sim-ar1.R
sim-ar1.RData
sim-ar1.Rout
sim-omit.R
sim-omit.RData
sim-omit.Rout
sim-stable.R
sim-stable.RData
sim-stable.Rout
sim.R
xgeepack.R
xzoo.R

README.md

Numerical results for "Assessing time-varying causal effect moderation in mobile health"

Simulation studies

The simulation results for each scenario are generated by the following R scripts. Running a script in batch mode from your system command line with, say,

R CMD BATCH --vanilla sim-omit.R

will create R output and simulation data files by the same name; sim-omit.Rout and sim-omit.RData, respectively.

File Description
sim-omit.R Averaging over an underlying moderator
sim-stable.R Weight stabilization
sim-ar1.R Non-independence working correlation structure

Each of these scripts call routines defined in the files below.

File Description
rsnmm.c Data generator
rsnmm.R Data generator interface
sim.R Simulation routine
init.R Loads required packages and reads source files
xgeepack.R Extensions for the geepack R package; extract, from a geepack model object, elements (e.g. working covariance, estimating function) needed for variance calculations
xzoo.R Extensions for the zoo R package; apply lags, difference, rolling summaries to a sample of time series
Application to simulated data

Instead of the application presented in the paper (which considers sensitive data), we provide an example using simulated data---both with and without use of the geepack R package. The zoo R package is used to easily define variables, but is not needed for estimation.

File Description
example_geepack.R Loads geepack and zoo extensions, generates data and runs an analysis similar to the application presented in the paper
example_geepack.Rout Provides the output obtained by running the example in batch mode
example.R Loads zoo extensions, generates data and runs an analysis similar to the application presented in the paper
example.Rout Provides the output obtained by running the example in batch mode
You can’t perform that action at this time.