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 "split" or "weighted"). See Details.

argvals

A list, containing the observation points for each element of the multivariate functional data that is to be simulated. The length of argvals determines the number of elements in the resulting simulated multivariate functional data. See Details.

M

An integer (type = "split") or a list of integers (type = "weighted"), giving the number of univariate basis functions to use. See Details.

eFunType

A character string (type = "split") or a list of character strings (type = "weighted"), specifying the type of univariate orthonormal basis functions to use. See Details.

ignoreDeg

A vector of integers (type = "split") or a list of integer vectors (type = "weighted"), specifying the degrees to ignore when generating the univariate orthonormal bases. Defaults to NULL. See Details.

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 eVal for details.

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:

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

If the j-th element of the simulated data should be defined on a two-dimensional domain, then

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 multiFunData object with N observations, representing the simulated multivariate functional data.

trueFuns

A multiFunData object with M observations, representing the multivariate eigenfunction basis used for simulating the data.

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)


[Package gmfamm version 0.1.0 Index]