plot.baclava {baclava} | R Documentation |
Plot Posterior Distribution Parameters
Description
Convenience function to facilitate exploration of posterior distributions through trace plots, autocorrelations, and densities, as well as plotting the estimated hazard for transitioning to the preclinical compartment.
Usage
## S3 method for class 'baclava'
plot(
x,
y,
...,
type = c("density", "trace", "acf", "hazard"),
burnin = 0L,
max_age = 90L,
trace_var = c("psi", "rate_H", "rate_P", "beta")
)
Arguments
x |
An object of class |
y |
Ignored |
... |
Ignored |
type |
A character object. One of {"density", "trace", "acf", "hazard"}. The type of plot to generate |
burnin |
An integer object. Optional. The number of burn-in samples.
Used only for |
max_age |
A numeric object. For |
trace_var |
A character object. The parameter for which trace plots are to be generated. Must be one of {"psi", "rate_H", "rate_P", "beta"} |
Value
A gg object
Examples
data(screen_data)
theta_0 <- list("rate_H" = 7e-4, "shape_H" = 2.0,
"rate_P" = 0.5 , "shape_P" = 1.0,
"beta" = 0.9, psi = 0.4)
prior <- list("rate_H" = 0.01, "shape_H" = 1,
"rate_P" = 0.01, "shape_P" = 1,
"a_psi" = 1/2 , "b_psi" = 1/2,
"a_beta" = 38.5, "b_beta" = 5.8)
# This is for illustration only -- the number of Gibbs samples should be
# significantly larger and the epsilon values should be tuned.
example <- fit_baclava(data.assess = data.screen,
data.clinical = data.clinical,
t0 = 30.0,
theta_0 = theta_0,
prior = prior)
plot(example)
plot(example, type = "trace", trace_var = "psi", burnin = 0L)
plot(example, type = "trace", trace_var = "rate_H", burnin = 0L)
plot(example, type = "trace", trace_var = "rate_P", burnin = 0L)
plot(example, type = "trace", trace_var = "beta", burnin = 0L)
plot(example, type = "acf")
plot(example, type = "hazard", max_age = 70)