R package that simulates data suitable for fitting Marginal Structural Model.
Switch branches/tags
Nothing to show
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.
R
man
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.md

README.md

simMSM

Maintainer: Ehsan Karim

I am a big fan of scientific collaboration. Feel free to contact me to discuss your causal inference related projects for potential collaboration.

R package to generate data suitable for Marginal Structural Cox Model fit

  • This package simulates survival data suitable for fitting Marginal Structural Model.

Installation

library(devtools)
install_github("ehsanx/simMSM")

Loading the package

require(simMSM)

Pulling the help file

?simmsm

Setting working directory to save the generated datafiles

setwd("C:/data") # change working dir

Using this package to generate data in the working directory

simmsm(subjects = 2500, tpoints = 10, psi = 0.3, n = 1000)
# This code generates 1000 datasets (takes time!)
# 2500 subjects in each datasets
# Each subject followed upto 10 time-points (say, months)
# Causal effect (log-odds) is 0.3
Parameter Description
subjects Number of Subjects in each simulated dataset
tpoints Maximum number of time-points each subjects are followed
psi Causal effect parameter for Marginal Structural Model
n Number of simulated datasets an user wants to generate

Author

  • Ehsan Karim :octocat: (only R porting from the SAS code). I wrote them in R basically to understand the mechanism, but the SAS / SAS IML / Stata codes (I have them as well, available upon request) are faster than this. Feel free to report any errors / update suggestions.

Original Papers

Follow-up References

Related web-Apps