| po_fit | R Documentation |
The po_fit function fits functional regression models for partially
observed functional data, where each curve is only observed over part of the
common domain.
po_fit(formula, data, family = stats::gaussian(), offset = NULL)
formula |
a formula object with at least one |
data |
a |
family |
a |
offset |
an offset vector. The default value is |
An object of class po_fit. It is a list containing the
following items:
An item named fit of class sop. See sop.fit.
An item named Beta which is a list with one data.frame per
functional term, each containing the grid (t), the estimated functional
coefficient (beta), its standard error (se) and the lower and upper
limits of the pointwise confidence interval (lower, upper).
An item named intercept which is the estimated intercept of the model.
An item named theta which is the basis coefficient vector of the
estimated functional coefficient.
An item named covar_theta which is the covariance matrix of the basis
coefficients, used to build the pointwise confidence intervals.
An item named M which holds the observed domain information for each
functional term.
An item named ffpo_evals which is the result of the evaluations of the
ffpo terms in the formula.
ffpo
# PARTIALLY OBSERVED FUNCTIONAL DATA EXAMPLE
# set seed for reproducibility
set.seed(123)
# generate example data with partially observed curves
sim <- data_generator_po_1d(n = 50, grid_points = 60)
X <- sim$noisy_curves_miss
y <- sim$response
grid <- sim$grid
mp <- sim$missing_points
# Fit the model using an 'ffpo' term for the partially observed covariate.
# 'nbasis' sets the number of basis functions for the data reconstruction
# and for the functional coefficient, respectively.
fit <- po_fit(
response ~ ffpo(X = X, missing_points = mp, grid = grid, nbasis = c(20, 20)),
data = list(response = y, X = X, grid = grid, missing_points = mp)
)
# Inspect the structure of the returned object
str(fit, max.level = 1)
# The estimated intercept and the basis coefficients can be accessed directly
fit$intercept
fit$theta
# A summary of the underlying fit can be obtained using the summary function
summary(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.