| plot.vem_fit | R Documentation |
Plots observed data, the posterior mean fitted curve, and an optional 95%
credible band for a single curve from a vem_fit object. The credible
band provides uncertainty quantification by sampling from the
variational posteriors: \beta_i \sim \text{MVN}(\boldsymbol{\mu}_{\boldsymbol{\beta}_i}, \boldsymbol{\Sigma}_{\boldsymbol{\beta}_i}) and
Z_{ki} \sim \text{Bernoulli}(p_{ki}).
Predictions are automatically back-transformed if the model was fitted with
center = TRUE or scale = TRUE.
## S3 method for class 'vem_fit'
plot(
x,
curve_idx = 1,
type = c("polygon", "lines"),
show_CI = TRUE,
n_samples = 200,
alpha_shade = 0.25,
ylim = NULL,
xlab = "t",
ylab = "Value",
show_basis = FALSE,
...
)
x |
A |
curve_idx |
Integer. Index of the curve to plot. Default |
type |
Character. Credible band style: |
show_CI |
Logical. If |
n_samples |
Integer. Number of posterior draws used to construct the
credible band. Default |
alpha_shade |
Numeric in |
ylim |
Optional numeric vector of length 2. If |
xlab |
Character. Label for the horizontal axis. Default |
ylab |
Character. Label for the vertical axis. Default |
show_basis |
Logical. If |
... |
Additional graphical parameters passed to |
Invisibly returns NULL. Called for its side effect of
producing a plot.
da Cruz, A. C., de Souza, C. P. E., & Sousa, P. H. T. O. (2024). Fast Bayesian basis selection for functional data representation with correlated errors. arXiv:2405.20758. https://arxiv.org/abs/2405.20758
vem_fit, predict.vem_fit
data(toy_curves)
fit <- vem_fit(y = toy_curves$y, Xt = toy_curves$Xt, K = 8)
# Default: shaded credible band for curve 1
plot(fit)
# Dashed credible band for curve 2
plot(fit, curve_idx = 2, type = "lines")
# With basis selection subplot
plot(fit, curve_idx = 1, show_basis = TRUE)
# Suppress credible band
plot(fit, show_CI = FALSE, main = "Mean fit only")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.