Skip to content
/ simMSM Public
forked from ehsanx/simMSM

R package that simulates data suitable for fitting Marginal Structural Model.

License

Notifications You must be signed in to change notification settings

guhjy/simMSM

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simMSM

Maintainer: Ehsan Karim: http://www.ehsankarim.com

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

About

R package that simulates data suitable for fitting Marginal Structural Model.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%