library(funData)
# Covariance matrix for the data generation in simulation scenario I
auto <- matrix(c(0.08, -0.07, -0.07, 0.9), ncol = 2)
cross <- matrix(rep(0.03, 4), ncol = 2)
cor <- matrix(c(0, 1, 0.75, 0.5, 0, 0,
1, 0, 1, 0.75, 0.5, 0,
0.75, 1, 0, 1, 0.75, 0.5,
0.5, 0.75, 1, 0, 1, 0.75,
0, 0.5, 0.75, 1, 0, 1,
0, 0, 0.5, 0.75, 1, 0),
ncol = 6)
cov <- kronecker(cor, cross) + kronecker(diag(c(1, 1.2, 1.4, 1.6, 1.8, 2)),
auto)
# Basis functions on each dimension
seq1 <- seq(0, 1, by = 0.01)
b_funs <- rep(list(funData(argvals = seq1,
X = matrix(c(rep(1, length(seq1)), seq1),
byrow = TRUE, ncol = length(seq1)))), 6)
# Prepare objects for the model on different data sets
mfpca_tru <- MFPCA_cov(cov = cov, basis_funs = b_funs)
Run the code above in your browser using DataLab