predict.pca_mfd: Predict from a multivariate functional PCA

View source: R/01_pca.mfd.R

predict.pca_mfdR Documentation

Predict from a multivariate functional PCA

Description

Computes either the scores of new observations on selected principal components, or their reconstruction from the selected components, given a PCA fitted by pca_mfd.

Usage

## S3 method for class 'pca_mfd'
predict(
  object,
  newdata = NULL,
  components = seq_len(ncol(object$pcscores)),
  type = c("scores", "reconstruction"),
  ...
)

Arguments

object

An object of class "pca_mfd", typically the output of pca_mfd.

newdata

An object of class "mfd" containing the new multivariate functional data to be projected. If NULL, the training data used to fit object are used.

components

Integer vector specifying the indices of the principal components to use. Defaults to all available components.

type

Character string: either "scores" (default) to return the scores of newdata, or "reconstruction" to return the data reconstructed from the selected components.

...

Further arguments passed to or from other methods (not used).

Details

This function is an S3 method for objects of class "pca_mfd". It is usually called via the generic predict function.

The new data are first centered and (optionally) scaled using the functional center and scale stored in the PCA object.

  • If type = "scores", inner products with the selected eigenfunctions are computed and summed across basis functions.

  • If type = "reconstruction", the predicted functional data are reconstructed from the scores and harmonics.

Value

  • If type = "scores", a numeric matrix of dimension nobs \times length(components).

  • If type = "reconstruction", an object of class "mfd".

See Also

pca_mfd, scale_mfd


funcharts documentation built on Dec. 12, 2025, 5:06 p.m.