pfpca {fgm} | R Documentation |
Partially Separable Karhunen-Loeve Expansion
Description
Estimates the Karhunen-Loeve expansion for a partially separable multivariate Gaussian process.
Usage
pfpca(y, t = seq(0, 1, length.out = dim(y[[1]])[2]))
Arguments
y |
list of length p containing densely observed multivariate (p-dimensional) functional data . |
t |
(optional) grid on which functional data is observed, defaults to seq(0, 1, m) where |
Details
This function implements the functional graphical model in Zapata, Oh, and Petersen (2019). This code uses functions from the testing version of fdapace available at: https://github.com/functionaldata/tPACE.
Value
A list with three variables:
phi
Lxm matrix where each row denotes the value of a basis function evaluated at a grid of length m
theta
list of length L of functional principal component scores.
theta[[l]]
is an nxp matrix of vector scores corresponding to the basis functionphi[l,]
FVE
fraction of functional variance explained (FVE) by the first L components
Author(s)
Javier Zapata, Sang-Yun Oh and Alexander Petersen
References
Zapata J., Oh S. and Petersen A. (2019) - Partial Separability and Functional Graphical Models for Multivariate Gaussian Processes. Available at https://arxiv.org/abs/1910.03134.
Examples
## Variables
# Omega - list of precision matrices, one per eigenfunction
# Sigma - list of covariance matrices, one per eigenfunction
# theta - list of functional principal component scores
# phi - list of eigenfunctions densely observed on a time grid
# y - list containing densely observed multivariate (p-dimensional) functional data
library(mvtnorm)
library(fda)
## Generate data y
source(system.file("exec", "getOmegaSigma.R", package = "fgm"))
theta = lapply(1:nbasis, function(b) t(rmvnorm(n = 100, sigma = Sigma[[b]])))
theta.reshaped = lapply( 1:p, function(j){
t(sapply(1:nbasis, function(i) theta[[i]][j,]))
})
phi.basis=create.fourier.basis(rangeval=c(0,1), nbasis=21, period=1)
t = seq(0, 1, length.out = time.grid.length)
chosen.basis = c(2, 3, 6, 7, 10, 11, 16, 17, 20, 21)
phi = t(predict(phi.basis, t))[chosen.basis,]
y = lapply(theta.reshaped, function(th) t(th)%*%phi)
## Solve
pfpca(y)