sum.effect {dpasurv} | R Documentation |
a sum method for class "effect"
## S3 method for class 'effect'
sum(effect1, effect2, ...)
effect1 |
an object of class "effect" obtained from a call to the function effect() |
effect2 |
a second object of class "effect" obtained from a call to the function effect() |
... |
additional objects of class "effect" (any number of effects allowed) |
an object of class "effect" containing the sum of effect1, effect2, ...
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)