type: A character string, specifying the basis for which the decomposition is to be calculated.
scores: A matrix of scores (coefficients) for each observation based on the given basis functions.
argvals: A list, representing the domain of the basis functions. If functions is not NULL, the usual default is functions@argvals. See funData and the underlying expansion functions for details.
functions: A functional data object, representing the basis functions. Can be NULL if the basis functions are not estimated from observed data, but have a predefined form. See Details.
params: A list containing the parameters for the particular basis to use.
Returns
An object of class funData with N observations on argvals, corresponding to the linear combination of the basis functions.
Details
This function calculates functional data Xi(t),i=1…N
that is represented as a linear combination of basis functions bk(t)
Xi(t)=k=1∑Kθikbk(t),i=1,…,N.
The basis functions may be prespecified (such as spline basis functions or Fourier bases) or can be estimated from observed data (e.g. by functional principal component analysis). If type = "default" (i.e. a linear combination of arbitrary basis functions is to be calculated), both scores and basis functions must be supplied.
Warning
The options type = "spline2Dpen", type = "DCT2D" and type = "DCT3D" have not been tested with ATLAS/MKL/OpenBLAS.
Examples
oldPar <- par(no.readonly =TRUE)par(mfrow = c(1,1))set.seed(1234)### Spline basis #### simulate coefficients (scores) for N = 10 observations and K = 8 basis functionsN <-10K <-8scores <- t(replicate(n = N, rnorm(K, sd =(K:1)/K)))dim(scores)# expand spline basis on [0,1]funs <- univExpansion(type ="splines1D", scores = scores, argvals = list(seq(0,1,0.01)), functions =NULL,# spline functions are known, need not be given params = list(bs ="ps", m =2, k = K))# params for mgcvplot(funs, main ="Spline reconstruction")### PCA basis #### simulate coefficients (scores) for N = 10 observations and K = 8 basis functionsN <-10K <-8scores <- t(replicate(n = N, rnorm(K, sd =(K:1)/K)))dim(scores)# Fourier basis functions as eigenfunctionseFuns <- eFun(argvals = seq(0,1,0.01), M = K, type ="Fourier")# expand eigenfunction basisfuns <- univExpansion(type ="uFPCA", scores = scores, argvals =NULL,# use argvals of eFuns (default) functions = eFuns)plot(funs, main ="PCA reconstruction")par(oldPar)