rfr_fpca: rfr_fpca Generic function for functional principal component...

View source: R/rfr_fpca.R

rfr_fpcaR Documentation

rfr_fpca Generic function for functional principal component analyses.

Description

Tidy interface to refund FPCA functions

Usage

rfr_fpca(Y, data, pve = 0.99, npc = NULL, method = NULL, ...)

## S3 method for class 'tfb'
rfr_fpca(Y, data, pve = 0.99, npc = NULL, ...)

## S3 method for class 'tfd_irreg'
rfr_fpca(Y, data, pve = 0.99, npc = NULL, method = fpca_sc, ...)

## S3 method for class 'tfd_reg'
rfr_fpca(Y, data, pve = 0.99, npc = NULL, method = fpca_face, ...)

Arguments

Y

Unquoted variable name for the tf data vector that will be decomposed using FPCA.

data

a data.frame containing the Y vector as a column.

pve

proportion of variance explained: used to choose the number of principal components.

npc

prespecified value for the number of principal components (if given, this overrides pve).

method

FPCA method of choice. Different options are available but default depends on regularity/irregularity of data, see Methods.

...

optional arguments to be passed to FPCA algorithms. Takes arguments from original refund functions.

Details

Allows calls to (wrappers for) refund::fpca.sc(), refund::fpca.face(), and refund::fpca.ssvd() as implemented in the {refund} package. Tidy functional data objects are input and tidy objects are returned as well.

Value

an object of class fpca, internal structure not yet fixed. Currently a list with a tidyfun::tfb_fpc() object and additional entries describingt the FPCA results.

Methods (by class)

  • tfd_irreg: FPCA for data on irregular grids defaults to refund::fpca.sc()

  • tfd_reg: FPCA for data on a regular grid defaults to refund::fpca.face()

Author(s)

Julia, Jeff, Fabian (plus any authors of the original refund code)

Examples

## Not run: 
library(refundr)
data(dti_df)
fpca_irregular <- rfr_fpca(Y = cca, data = dti_df)

data(chf_df)
fpca_regular <- rfr_fpca(Y = activity, data = chf_df)

## End(Not run)


tidyfun/refunder documentation built on April 2, 2022, 2:14 a.m.