dctBasis2D function

Calculate a cosine basis representation for functional data on two- or three-dimensional domains

Calculate a cosine basis representation for functional data on two- or three-dimensional domains

These functions calculate a tensor cosine basis representation for functional data on two- or three-dimensional domains based on a discrete cosine transformation (DCT) using the C-library fftw3

(http://www.fftw.org/). Coefficients under a given threshold are set to 0 to reduce complexity and for denoising.

dctBasis2D(funDataObject, qThresh, parallel = FALSE) dctBasis3D(funDataObject, qThresh, parallel = FALSE)

Arguments

  • funDataObject: An object of class funData

    containing the observed functional data samples and for which the basis representation is calculated.

  • qThresh: A numeric with value in [0,1][0,1], giving the quantile for thresholding the coefficients. See Details.

  • parallel: Logical. If TRUE, the coefficients for the basis functions are calculated in parallel. The implementation is based on the foreach function and requires a parallel backend that must be registered before; see foreach for details. Defaults to FALSE.

Returns

  • scores: A sparseMatrix of scores (coefficients) with dimension N x K, reflecting the weights θmn\theta_{mn} (θmnk\theta_{mnk}) for each basis function in each observation, where K is the total number of basis functions used. - B: A diagonal matrix, giving the norms of the different basis functions used (as they are orthogonal).

  • ortho: Logical, set to FALSE, as basis functions are orthogonal, but in general not orthonormal.

  • functions: NULL, as basis functions are known.

Details

Given the (discretized) observed functions XiX_i, the function dctBasis2D calculates a basis representation

Xi(s,t)=m=0K11n=0K21θmnfmn(s,t) X_i(s,t) =\sum_{m = 0}^{K_1-1} \sum_{n = 0}^{K_2-1} \theta_{mn} f_{mn}(s,t)

of a two-dimensional function Xi(s,t)X_i(s,t) in terms of (orthogonal) tensor cosine basis functions

fmn(s,t)=cmcncos(ms)cos(nt),(s,t)Tfmn(s,t)=cmcncos(ms)cos(nt),(s,t)\calT f_{mn}(s,t) = c_m c_n \cos(ms) \cos(nt),\quad (s,t) \in \mathcal{T}f_{mn}(s,t) = c_m c_n \cos(ms) \cos(nt),\quad (s,t) \in \calT

with cm=1πc_m = \frac{1}{\sqrt{\pi}} for m=0m=0 and cm=2πc_m = \sqrt{\frac{2}{\pi}} for m=1,2,m=1,2,\ldots

based on a discrete cosine transform (DCT).

If not thresholded (qThresh = 0), the function returns all non-zero coefficients θmn\theta_{mn} in the basis representation in a sparseMatrix (package Matrix) called scores. Otherwise, coefficients with

θmn<=q |\theta_{mn}| <= q

are set to zero, where qq is the qThresh-quantile of θmn|\theta_{mn}|.

For functions Xi(s,t,u)X_i(s,t,u) on three-dimensional domains, the function dctBasis3D calculates a basis representation

Xi(s,t,u)=m=0K11n=0K21k=0K31θmnkfmnk(s,t,u) X_i(s,t,u) = \sum_{m = 0}^{K_1-1} \sum_{n = 0}^{K_2-1} \sum_{k =0}^{K_3-1} \theta_{mnk} f_{mnk}(s,t,u)

in terms of (orthogonal) tensor cosine basis functions

fmnk(s,t,u)=cmcnckcos(ms)cos(nt)cos(ku),(s,t,u)Tfmnk(s,t,u)=cmcnckcos(ms)cos(nt)cos(ku),(s,t,u)\calT f_{mnk}(s,t,u) = c_m c_n c_k \cos(ms)\cos(nt) \cos(ku), \quad (s,t,u) \in \mathcal{T}f_{mnk}(s,t,u) = c_mc_n c_k \cos(ms) \cos(nt) \cos(ku), \quad (s,t,u) \in \calT

again with cm=1pic_m = \frac{1}{\sqrt{pi}} for m=0m=0 and c("cm=\nc_m =\n", "sqrtfrac2pi\\sqrt{\\frac{2}{pi}}") for m=1,2,m=1,2,\ldots based on a discrete cosine transform (DCT). The thresholding works analogous as for the two-dimensional case.

Warning

If the C-library fftw3 is not available when the package MFPCA is installed, this function is disabled an will throw an error. For full functionality install the C-library fftw3 from http://www.fftw.org/ and reinstall MFPCA. This function has not been tested with ATLAS/MKL/OpenBLAS.

See Also

univDecomp, dct2D, dct3D