simMuFu {gmfamm} | R Documentation |
Simulate multivariate functional data
Description
This function provides a unified simulation structure for multivariate
functional data f_1, \ldots, f_N
on one- or two-dimensional domains,
based on a truncated multivariate Karhunen-Loeve representation:
f_i(t)
= \sum_{m = 1}^M \rho_{i,m} \psi_m(t).
The multivariate eigenfunctions
(basis functions) \psi_m
are constructed from univariate orthonormal
bases. There are two different concepts for the construction, that can be
chosen by the parameter type
: A split orthonormal basis (split
,
only one-dimensional domains) and weighted univariate orthonormal bases
(weighted
, one- and two-dimensional domains). The scores
\rho_{i,m}
in the Karhunen-Loeve representation are simulated
independently from a normal distribution with zero mean and decreasing
variance. See Details.
Usage
simMuFu(
type,
argvals,
M,
eFunType,
ignoreDeg = NULL,
eValType,
N,
seed,
seed_funs = 8
)
Arguments
type |
A character string, specifying the construction method for the
multivariate eigenfunctions (either |
argvals |
A list, containing the observation points for each element of
the multivariate functional data that is to be simulated. The length of
|
M |
An integer ( |
eFunType |
A character string ( |
ignoreDeg |
A vector of integers ( |
eValType |
A character string, specifying the type of
eigenvalues/variances used for the simulation of the multivariate functions
based on the truncated Karhunen-Loeve representation. See
|
N |
An integer, specifying the number of multivariate functions to be generated. |
seed |
A random seed for the score generation. |
seed_funs |
A random seed to make the eigenfunction creation reproducible. |
Details
The parameter type
defines how the eigenfunction basis for the
multivariate Karhunen-Loeve representation is constructed:
-
type = "split"
: The basis functions of an underlying 'big' orthonormal basis are split inM
parts, translated and possibly reflected. This yields an orthonormal basis of multivariate functions withM
elements. This option is implemented only for one-dimensional domains. -
type = "weighted":
The multivariate eigenfunction basis consists of weighted univariate orthonormal bases. This yields an orthonormal basis of multivariate functions withM
elements. For data on two-dimensional domains (images), the univariate basis is constructed as a tensor product of univariate bases in each direction (x- and y-direction).
Depending on type
, the other parameters have to be specified as
follows:
Split 'big' orthonormal basis
The parameters M
(integer), eFunType
(character string) and ignoreDeg
(integer
vector or NULL
) are passed to the function eFun
to
generate a univariate orthonormal basis on a 'big' interval. Subsequently,
the basis functions are split and translated, such that the j
-th part
of the split function is defined on the interval corresponding to
argvals[[j]]
. The elements of the multivariate basis functions are
given by these split parts of the original basis functions multiplied by a
random sign \sigma_j \in \{-1,1\}, j = 1, \ldots, p
.
Weighted orthonormal bases
The parameters argvals, M,
eFunType
and ignoreDeg
are all lists of a similar structure. They are
passed element-wise to the function eFun
to generate
orthonormal basis functions for each element of the multivariate functional
data to be simulated. In case of bivariate elements (images), the
corresponding basis functions are constructed as tensor products of
orthonormal basis functions in each direction (x- and y-direction).
If the j
-th element of the simulated data should be defined on a
one-dimensional domain, then
-
argvals[[j]]
is a list, containing one vector of observation points. -
M[[j]]
is an integer, specifying the number of basis functions to use for this entry. -
eFunType[[j]]
is a character string, specifying the type of orthonormal basis functions to use for this entry (seeeFun
for possible options). -
ignoreDeg[[j]]
is a vector of integers, specifying the degrees to ignore when constructing the orthonormal basis functions. The default value isNULL
.
If the j
-th element of the simulated data should be defined on a
two-dimensional domain, then
-
argvals[[j]]
is a list, containing two vectors of observation points, one for each direction (observation points in x-direction and in y-direction). -
M[[j]]
is a vector of two integers, giving the number of basis functions for each direction (x- and y-direction). -
eFunType[[j]]
is a vector of two character strings, giving the type of orthonormal basis functions for each direction (x- and y-direction, seeeFun
for possible options). The corresponding basis functions are constructed as tensor products of orthonormal basis functions in each direction. -
ignoreDeg[[j]]
is a list, containing two integer vectors that specify the degrees to ignore when constructing the orthonormal basis functions in each direction. The default value isNULL
.
The total number of basis functions (i.e. the
product of M[[j]]
for all j
) must be equal!
This code is a direct copy of the function simMultiFunData
in the
funData
package (version 1.3-9) and slightly adapted. It also returns
the simulated scores and needs the additional argument seed
to
generate reproducible eigenvalues and eigenfunctions.
Value
simData |
A |
trueFuns |
A |
trueVals |
A vector of numerics, representing the eigenvalues used for simulating the data. |
score |
A matrix containing the simulated scores. |
References
C. Happ, S. Greven (2018): Multivariate Functional Principal Component Analysis for Data Observed on Different (Dimensional) Domains. Journal of the American Statistical Association, 113(522): 649-659.
Examples
oldPar <- par(no.readonly = TRUE)
library(funData)
# split
split <- simMuFu(type = "split", argvals = list(seq(0,1,0.01),
seq(-0.5,0.5,0.02)),
M = 5, eFunType = "Poly", eValType = "linear", N = 7,
seed = 2)
par(mfrow = c(1,2))
plot(split$trueFuns, main = "Split: True Eigenfunctions", ylim = c(-2,2))
plot(split$simData, main = "Split: Simulated Data")
# weighted (one-dimensional domains)
par(oldPar)