Plot as a probability mass function (suffix _pmf
) or
as a fanchart (stacked confidence interval, suffix _fanchart
).
plot_post_traj_*
plots the posterior predictive trajectory onlyplot_ppc_traj_*
overlays the observed trajectory to the posterior predictive trajectory
Usage
plot_post_traj_pmf(
obj,
id,
patient_id,
max_score = NA,
support = NULL,
max_scale = NA
)
plot_post_traj_fanchart(
obj,
id,
patient_id,
max_score = NA,
interval = c("eti", "hdi"),
CI_level = seq(0.1, 0.9, 0.1),
...
)
plot_ppc_traj_pmf(obj, train, test, patient_id, max_score = NA, ...)
plot_ppc_traj_fanchart(obj, train, test, patient_id, max_score = NA, ...)
Arguments
- obj
Stanfit object or matrix of replications, with rows corresponding to samples and columns corresponding to variables (there should be
nrow(id)
columns).- id
Dataframe linking index in
obj
to (Patient
,Time
) pairs, cf. output fromget_index()
.- patient_id
Patient ID.
- max_score
(Optional) Maximum value that the score can take. In
plot_*_traj_pmf
this will setsupport
if it is not supplied. Inplot_*_traj_fanchart
this will set the y axis range. Inplot_ppc_traj_*
this will check the content oftrain
andtest
.- support
Values that the discrete distribution can take. Can be NULL, in that case the support of the pmf is estimated from the data (cf.
HuraultMisc::extract_distribution()
).- max_scale
Maximum value that the legend display. If NA, this chosen automatically.
- interval
Type of confidence of interval to display, one of "eti" for equal-tailed intervals and "hdi" for highest density interval.
- CI_level
Vector of confidence level to plot for the fanchart.
- ...
arguments to pass to
plot_post_traj_*
. Forplot_post_traj_fanchart()
, arguments to pass toadd_fanchart()
.- train
Training dataset used to obtain the fit.
- test
Testing dataset used to obtain the fit (can be
NULL
).