This function provides a unified simulation structure for multivariate functional data f_1, …, f_N on one or twodimensional domains, based on a truncated multivariate KarhunenLoeve representation:
f_i(t) = ∑_{m = 1}^M ρ_{i,m} ψ_m(t).
The multivariate eigenfunctions
(basis functions) ψ_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 onedimensional domains) and weighted univariate orthonormal bases
(weighted
, one and twodimensional domains). The scores
ρ_{i,m} in the KarhunenLoeve representation are simulated
independently from a normal distribution with zero mean and decreasing
variance. See Details.
1  simMultiFunData(type, argvals, M, eFunType, ignoreDeg = NULL, eValType, N)

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 KarhunenLoeve representation. See

N 
An integer, specifying the number of multivariate functions to be generated. 
The parameter type
defines how the eigenfunction basis for the
multivariate KarhunenLoeve representation is constructed:
type = "split"
: The basis functions of an underlying 'big' orthonormal
basis are split in M
parts, translated and possibly reflected. This
yields an orthonormal basis of multivariate functions with M
elements. This option is implemented only for onedimensional domains.
type = "weighted":
The multivariate eigenfunction basis consists of
weighted univariate orthonormal bases. This yields an orthonormal basis of
multivariate functions with M
elements. For data on twodimensional
domains (images), the univariate basis is constructed as a tensor product of
univariate bases in each direction (x and ydirection).
Depending on type
, the other parameters have to be specified as
follows:
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 jth 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 σ_j in {1,1},
j = 1, …, p.
The parameters argvals, M,
eFunType
and ignoreDeg
are all lists of a similar structure. They are
passed elementwise 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 ydirection).
If the jth element of the simulated data should be defined on a onedimensional domain, then
argvals[[j]]
is a list,
containing one vector of observation points.
M[[j]]
is an
integer, specifiying 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 (see eFun
for
possible options).
ignoreDeg[[j]]
is a vector of integers,
specifying the degrees to ignore when constructing the orthonormal basis
functions. The default value is NULL
.
If the jth element of the simulated data should be defined on a twodimensional domain, then
argvals[[j]]
is a list,
containing two vectors of observation points, one for each direction
(observation points in xdirection and in ydirection).
M[[j]]
is a vector of two integers, giving the number of basis functions for each
direction (x and ydirection).
eFunType[[j]]
is a vector of two
character strings, giving the type of orthonormal basis functions for each
direction (x and ydirection, see eFun
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 is NULL
.
The total number of basis functions (i.e. the
product of M[[j]]
for all j
) must be equal!
simData 
A 
trueFuns 
A 
trueVals 
A vector of numerics, representing the eigenvalues used for simulating the data. 
C. Happ, S. Greven (2015): Multivariate Functional Principal Component Analysis for Data Observed on Different (Dimensional) Domains. Preprint on arXiv: http://arxiv.org/abs/1509.02029
multiFunData
, eFun
,
eVal
, simFunData
, addError
,
sparsify
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  oldPar < par(no.readonly = TRUE)
# split
split < simMultiFunData(type = "split", argvals = list(seq(0,1,0.01), seq(0.5,0.5,0.02)),
M = 5, eFunType = "Poly", eValType = "linear", N = 7)
par(mfrow = c(1,2))
plot(split$trueFuns, main = "Split: True Eigenfunctions", ylim = c(2,2))
plot(split$simData, main = "Split: Simulated Data")
# weighted (onedimensional domains)
weighted1D < simMultiFunData(type = "weighted",
argvals = list(list(seq(0,1,0.01)), list(seq(0.5,0.5,0.02))),
M = c(5,5), eFunType = c("Poly", "Fourier"), eValType = "linear", N = 7)
plot(weighted1D$trueFuns, main = "Weighted (1D): True Eigenfunctions", ylim = c(2,2))
plot(weighted1D$simData, main = "Weighted (1D): Simulated Data")
# weighted (one and twodimensional domains)
weighted < simMultiFunData(type = "weighted",
argvals = list(list(seq(0,1,0.01), seq(0,10,0.1)), list(seq(0.5,0.5,0.01))),
M = list(c(5,4), 20), eFunType = list(c("Poly", "Fourier"), "Wiener"),
eValType = "linear", N = 7)
plot(weighted$trueFuns, main = "Weighted: True Eigenfunctions (m = 2)", obs = 2)
plot(weighted$trueFuns, main = "Weighted: True Eigenfunctions (m = 15)", obs = 15)
plot(weighted$simData, main = "Weighted: Simulated Data (1st observation)", obs = 1)
plot(weighted$simData, main = "Weighted: Simulated Data (2nd observation)", obs = 2)
par(oldPar)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.