Sum of direct and indirect effects from dynamic path analysis
sum.effect.Rd
a sum method for class "effect"
Usage
# S3 method for class 'effect'
sum(effect1, effect2, ...)
Examples
library(dpasurv)
data(simdata)
set.seed(1)
# Perform dynamic path analysis:
# We set boot.n=30 for the example to run fast, should be set large enough
# so that results don't change meaningfully for different seeds.
s <- dpa(Surv(start,stop,event)~M+x, list(M~x), id="subject", data=simdata, boot.n=30)
direct <- effect(x ~ outcome, s)
indirect <- effect(x ~ M ~ outcome, s)
total <- sum(direct, indirect)