R-package for Dynamic Path Analysis of survival data.
The dpasurv package is designed to perform dynamic path analysis via calls to the following principal functions:
dpa()
fits the dynamic path models corresponding to a
given dynamic path diagram; returns an object of class dpaeffect()
estimates the cumulative direct and indirect
effects from the fitted dpa-object; returns an object of class
effectThe effect-objects can be summed together to obtain the total effect (i.e. direct effect + indirect effect) as well as plotted with bootstrap confidence intervals.
# To install the most recent stable version on CRAN:
install.packages("dpasurv")
# To get bug fixes or new features, install the development version:
::install_github("Novartis/dpasurv") devtools
A vignette on how to use the dpasurv package can be found here, and basic usage is summarized below:
library(dpasurv)
# Perform dynamic path analysis
<- dpa(Surv(start, stop, event) ~ M + x, list(M ~ x), id = "subject", data = simdata, boot.n = 500)
s
# Extract direct, indirect and total effect
<- effect(x ~ outcome, s, alpha=0.05)
direct <- effect(x ~ M ~ outcome, s, alpha=0.05)
indirect <- sum(direct, indirect)
total
# Plot the results
par(mfrow=c(1,3))
plot(direct); abline(h=0, lty=2, col=2)
plot(indirect); abline(h=0, lty=2, col=2)
plot(total); abline(h=0, lty=2, col=2)
# Plot the results with ggplot2 graphics:
ggplot.effect(list(direct, indirect, total))
The dpasurv package was created as supplementary code for the following manuscript:
@article{dpasurv,
={Dynamic path analysis for exploring treatment effect mediation processes in clinical trials with time-to-event endpoints},
title={Kormaksson, M. and Lange, M. R. and Demanse, D. and Strohmaier, S. and Duan, J. and Xie, Q. and Carbini, M. and Bossen, C. and Guettner, A. and Maniero, A.},
author={Statistics in Medicine (Accepted)},
journal={},
volume={},
number={},
pages={2024},
year }
If you publish results obtained from the dpasurv package, please cite the above paper.