| plot_ci | R Documentation |
Generates a plot of functional Beta estimates for specified curves, along with their 95% confidence intervals. This function computes the 95% confidence intervals for each curve based on the covariance matrix and the fitted values from the provided object. The resulting plot includes estimated curves, confidence interval ribbons, and a legend distinguishing the curves.
plot_ci(object, beta_index = 1, curves)
object |
An object of class |
beta_index |
An integer specifying which Beta coefficient matrix to use. Default is 1. |
curves |
A numeric vector specifying the indices of the curves (rows) to plot. |
A ggplot2 object displaying the Beta estimates and confidence intervals for the specified curves.
vd_fit
if (requireNamespace("ggplot2", quietly = TRUE)) {
# set seed for reproducibility
set.seed(42)
# generate variable domain functional data and fit the model
data <- data_generator_vd(N = 100, J = 100, beta_index = 1)
res <- vd_fit(y ~ ffvd(X_se, nbasis = c(10, 10, 10)), data = data)
# plot the estimated coefficient and its confidence intervals
# for a selection of curves
plot_ci(res, beta_index = 1, curves = c(50, 70, 100))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.