SparseProductFPCA {fdarep}R Documentation

Product Functional Principal Component Analysis for sparse repeated functional data.

Description

Note: The code works for sparse functional data.

Usage

SparseProductFPCA(
  sSup,
  Lt,
  Ly,
  fpca.op1 = list(),
  fpca.op2 = list(),
  pc.j = NULL,
  pc.k = NULL,
  bw_mu_min = NULL,
  bw_mu_max = NULL
)

Arguments

sSup

A vector of length num.ages representing the common grid for every individual in the direction of (age) dimension 2.

Lt

A list of n vectors containing the observation time points for every individual, such that the ith element of the list gives the num.years.i points in the direction of (year) dimension 1 at which the functional-valued stochastic process is observed for the ith individual.

Ly

A list of n matrices containing the observed values for every individual, such that the ith element is an num.ages by num.years.i matrix of observed values for the i-th individual.

fpca.op1

A list of options control parameters specified by list(name=value) for FPCA in direction of (age) dimension 2; check fdapace::FPCA for available control options and default settings.

fpca.op2

A list of options control parameters specified by list(name=value)for FPCA in direction of (year) dimension 1; check fdapace::FPCA for available control options and default settings.

pc.j

A scalar denoting the maximum number of components to consider for FPCA in direction of (age) dimension 2; default: chosen by FVE if NULL

pc.k

A scalar denoting the maximum number of components to consider for FPCA in direction of (year) dimension 1; default: chosen by FVE if NULL.

bw_mu_min

The minimum bandwidth value considered for bandwidth selection in mean function estimation, such that the final bandwidth chosen by 5-fold cross validation is above this minimum value; default:NULL, bandwidth chosen by 5-fold cross validation over the default range.

bw_mu_max

The maximum bandwidth value considered for bandwidth selection in mean function estimation, such that the final bandwidth chosen by 5-fold cross validation is below this value; default:NULL, bandwidth chosen by 5-fold cross validation over the default range.

Details

This code works for sparse functional data, with the notion of sparsity defined as follows. Sparsity in the year direction (dimension 1) means that the years at which the data are observed for a country (or individual unit) are sparsely distributed. However for the ith county (or individual unit), if the data are available for a particular year (dimension 1), then it is available for all the ages (dimension 2) in sSup corresponding to that specific year. Thus along (age) dimension 2, data type is dense. The 'usergrid' control option in FPCA indicates whether to use observation grid for fitting, if false FPCA will use equidistant grid. logical - default:FALSE. Along (age) dimension 2, FPCA is done for only for sSup as observation grid. Depending on the choice of usergrid for 'fpca.op2', FPCA in (year) dimension 1 is either fitted on the observed (pooled) grid or on the internal regular grid of default length 51.

Value

A list containing the following fields:

age.grid

A vector of length num.ages, representing the grid used for fitting FPCA in the direction of (age) dimension 2, same as sSup.

year.grid

A vector of length nWorkGrid, representing the grid used for fitting FPCA in the direction of (year) dimension 1.

mu

An num.ages by nWorkGrid matrix containing the bivariate mean function estimate.

bwMu

The selected bandwidth for mean function estimation.

pc.j

A scalar denoting the selected number of components for FPCA in direction of (age) dimension 2.

pc.k

A scalar denoting the selected number of components for FPCA in direction of (year) dimension 1.

res.psi

A list containing the FPCA output for FPCA in direction of (age) dimension 2.

res.phi

A list containing the FPCA output for FPCA in direction of (year) dimension 1.

scores

A list of pc.j matrices containing the estimated scores, such that the jth element of the list is an n by pc.k matrix with its ith row comprising the estimated scores chi_{j,1},..., chi_{j,pc.k[j]} for the ith individual.

psi

An num.ages by pc.j matrix containing the estimated eigenfunctions from FPCA in direction of (age) dimension 2.

phi

An nWorkGrid by pc.k matrix, containing the estimated eigenfunctions from FPCA in direction of (year) dimension 1.

VarOrdered

A list of pc.j vectors each of length pc.k, containing the variance explained by each term. The terms are ordered by var(chi_{jk}). One can select the best model by truncating at a desired level of FVE, and use names(VarOrdered) to see the corresponding model terms.

References

Examples


Ly <- lapply(1:20, function(i){matrix(rnorm(13*(i)), 13, i)})
Lt <- lapply(1:20, function(i){1:(i)})
sSup <- c(1:13)
pc.j <- 2
pc.k <- 3
fpca.op1 <- NULL
fpca.op2 <- NULL
bw_mu_max <- 5.625000/2
bw_mu_min <- NULL
res <- SparseProductFPCA(sSup, Lt, Ly, fpca.op1, fpca.op2, pc.j, pc.k, bw_mu_min, bw_mu_max)



[Package fdarep version 0.1.1 Index]