Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

CreatePathPlot

Create the fitted sample path plot based on the results from FPCA().


Description

Create the fitted sample path plot based on the results from FPCA().

Usage

CreatePathPlot(
  fpcaObj,
  subset,
  K = NULL,
  inputData = fpcaObj[["inputData"]],
  showObs = !is.null(inputData),
  obsOnly = FALSE,
  showMean = FALSE,
  derOptns = list(p = 0),
  ...
)

Arguments

fpcaObj

Returned object from FPCA().

subset

A vector of indices or a logical vector for subsetting the observations.

K

The number of components to reconstruct the fitted sample paths.

inputData

A list of length 2 containing the sparse/dense (unsupported yet) observations. inputData needs to contain two fields: Lt for a list of time points and Ly for a list of observations. Default to the 'inputData' field within 'fpcaObj'.

showObs

Whether to plot the original observations for each subject.

obsOnly

Whether to show only the original curves.

showMean

Whether to plot the mean function as a bold solid curve.

derOptns

A list of options to control derivation parameters; see ‘fitted.FPCA’. (default = NULL)

...

other arguments passed into matplot for plotting options

Examples

set.seed(1)
n <- 20
pts <- seq(0, 1, by=0.05)
sampWiener <- Wiener(n, pts)
sampWiener <- Sparsify(sampWiener, pts, 10)
res <- FPCA(sampWiener$Ly, sampWiener$Lt, 
            list(dataType='Sparse', error=FALSE, kernel='epan',
            verbose=TRUE))
CreatePathPlot(res, subset=1:5)

# CreatePathPlot has a lot of usages:

CreatePathPlot(res)
CreatePathPlot(res, 1:20)
CreatePathPlot(res, 1:20, showObs=FALSE)
CreatePathPlot(res, 1:20, showMean=TRUE, showObs=FALSE)
CreatePathPlot(res, 1:20, obsOnly=TRUE)
CreatePathPlot(res, 1:20, obsOnly=TRUE, showObs=FALSE)
CreatePathPlot(inputData=sampWiener, subset=1:20, obsOnly=TRUE)

fdapace

Functional Data Analysis and Empirical Dynamics

v0.5.6
BSD_3_clause + file LICENSE
Authors
Cody Carroll [aut, cre] (<https://orcid.org/0000-0003-3525-8653>), Alvaro Gajardo [aut], Yaqing Chen [aut], Xiongtao Dai [aut], Jianing Fan [aut], Pantelis Z. Hadjipantelis [aut], Kyunghee Han [aut], Hao Ji [aut], Shu-Chin Lin [ctb], Paromita Dubey [ctb], Hans-Georg Mueller [cph, ths, aut], Jane-Ling Wang [cph, ths, aut]
Initial release
2021-01-10,

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.