Description Usage Arguments Value See Also Examples
This functions simulates (univariate) functional data f_1,…, f_N based on a truncated Karhunen-Loeve representation:
f_i(t) = ∑_{m = 1}^M ξ_{i,m} φ_m(t).
on one- or
higher-dimensional domains. The eigenfunctions (basis functions) φ_m(t) are generated
using eFun
, the scores ξ_{i,m} are simulated independently from a normal
distribution with zero mean and decreasing variance based on the eVal
function. For
higher-dimensional domains, the eigenfunctions are constructed as tensors of marginal orthonormal
function systems.
1 | simFunData(argvals, M, eFunType, ignoreDeg = NULL, eValType, N)
|
argvals |
A numeric vector, containing the observation points (a fine grid on a real interval) of the functional data that is to be simulated or a list of the marginal observation points. |
M |
An integer, giving the number of univariate basis functions to use. For higher-dimensional data, |
eFunType |
A character string specifying the type of univariate orthonormal basis functions
to use. For data on higher-dimensional domains, |
ignoreDeg |
A vector of integers, specifying the degrees to ignore when generating the
univariate orthonormal bases. Defaults to |
eValType |
A character string, specifying the type of eigenvalues/variances used for the
generation of the simulated functions based on the truncated Karhunen-Loeve representation. See
|
N |
An integer, specifying the number of multivariate functions to be generated. |
simData |
A |
trueFuns |
A |
trueVals |
A vector of numerics, representing the true eigenvalues used for simulating the data. |
funData
, eFun
, eVal
,
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)
# Use Legendre polynomials as eigenfunctions and a linear eigenvalue decrease
test <- simFunData(seq(0,1,0.01), M = 10, eFunType = "Poly", eValType = "linear", N = 10)
plot(test$trueFuns, main = "True Eigenfunctions")
plot(test$simData, main = "Simulated Data")
# The use of ignoreDeg for eFunType = "PolyHigh"
test <- simFunData(seq(0,1,0.01), M = 4, eFunType = "Poly", eValType = "linear", N = 10)
test_noConst <- simFunData(seq(0,1,0.01), M = 4, eFunType = "PolyHigh",
ignoreDeg = 1, eValType = "linear", N = 10)
test_noLinear <- simFunData(seq(0,1,0.01), M = 4, eFunType = "PolyHigh",
ignoreDeg = 2, eValType = "linear", N = 10)
test_noBoth <- simFunData(seq(0,1,0.01), M = 4, eFunType = "PolyHigh",
ignoreDeg = 1:2, eValType = "linear", N = 10)
par(mfrow = c(2,2))
plot(test$trueFuns, main = "Standard polynomial basis (M = 4)")
plot(test_noConst$trueFuns, main = "No constant basis function")
plot(test_noLinear$trueFuns, main = "No linear basis function")
plot(test_noBoth$trueFuns, main = "Neither linear nor constant basis function")
# Higher-dimensional domains
simImages <- simFunData(argvals = list(seq(0,1,0.01), seq(-pi/2, pi/2, 0.02)),
M = c(5,4), eFunType = c("Wiener","Fourier"), eValType = "linear", N = 4)
for(i in 1:4)
plot(simImages$simData, obs = i, main = paste("Observation", i))
par(oldPar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.