simMultiFunData: Simulate multivariate functional data

View source: R/simulation.R

simMultiFunDataR 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

simMultiFunData(type, argvals, M, eFunType, ignoreDeg = NULL, eValType, N)

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.

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 in M parts, translated and possibly reflected. This yields an orthonormal basis of multivariate functions with M 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 with M 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 (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 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, 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!

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.

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.

See Also

multiFunData, eFun, eVal, simFunData, addError, sparsify.

Examples

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 (one-dimensional 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 two-dimensional 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)

ClaraHapp/funData documentation built on Feb. 20, 2024, 6:07 p.m.