Description Usage Arguments Details Value Author(s) References Examples
Estimates the Karhunen-Loeve expansion for a partially separable multivariate Gaussian process.
1 |
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 |
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.
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 function phi[l,]
FVE
fraction of functional variance explained (FVE) by the first L components
Javier Zapata, Sang-Yun Oh and Alexander Petersen
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.