View source: R/predict_shrinkDSM.R
| plot.shrinkDSM_pred | R Documentation |
plot.shrinkDSM_pred generates plots visualizing the posterior predictive density generated by predict.shrinkDSM.
## S3 method for class 'shrinkDSM_pred' plot(x, dens_args, legend = TRUE, ...)
x |
a |
dens_args |
optional named list containing arguments passed to |
legend |
logical value inidicating whether a legend should be added. Defaults to |
... |
further arguments to be passed to |
Called for its side effects and returns invisibly.
Other plotting functions:
plot.mcmc.dsm.tvp(),
plot.shrinkDSM()
set.seed(123)
data("gastric")
# Create intervals for piecewise exponential model
intervals <- divisionpoints(gastric$time, gastric$status, 2)
# Estimate model
mod <- shrinkDSM(time ~ radiation, gastric,
delta = gastric$status, S = intervals)
# Draw from posterior predictive distribution
newdata <- data.frame(radiation = c(0, 1))
pred <- predict(mod, newdata = newdata)
# Plot predictions
plot(pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.