sum.effect {dpasurv} | R Documentation |
Sum of direct and indirect effects from dynamic path analysis
Description
a sum method for class "effect"
Usage
## S3 method for class 'effect'
sum(effect1, effect2, ...)
Arguments
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) |
Value
an object of class "effect" containing the sum of 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)
[Package dpasurv version 0.1.0 Index]