General approach of causal mediation analysis for survival outcome under sequential mediators
To install this package, please copy and paste following codes into your R session:
install_github("AshTai/iPSEsv")
Required packages:
require(timereg)
library(iPSEsv)
data <- data.frame(time=c(4,3,1,1,2,2,3,3,5,10,2,5,1,7)
status=c(1,1,1,0,1,1,0,1,1,1,0,1,1,0)
x1=rnorm(14,0,1)
x2=rnorm(14,0,1)
x3=rnorm(14,0,1)
c1=rnorm(14,0,1)
c2=rnorm(14,0,1)
c3=rnorm(14,0,1)
sex=c(0,0,1,0,1,1,1,1,1,0,0,0,0,1)
age=c(10,4,2,19,22,31,18,21,41,22,31,29,11,32)
E=sample(c(0,1),size = 14,replace = T))
base.conf <- c("sex","age")
time.conf <- c("c1","c2","c3")
mediators <- c("x1","x2","x3")
DAGs <- c("c1","x1","c2","x2","c3","x3")
exposure <- "E"
output <- iPSEsv(data=data,exposure=exposure,base.conf=base.conf,time.conf=time.conf,
mediators=mediators,DAGs=DAGs,suv.model="Aalen")
An-Shun Tai (daansh13@gmail.com) https://anshuntai.weebly.com Pei-Hsuan Lin (a52012232@gmail.com) Sheng-Hsuan Lin (shenglin@nctu.edu.tw)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.