Calculate a spline basis decomposition for functional data on one-dimensional domains
Calculate a spline basis decomposition for functional data on one-dimensional domains
These functions calculate a penalized or unpenalized spline basis decomposition for functional data on one-dimensional domains based on the gam function in the mgcv package.
splineBasis1D(funDataObject, bs ="ps", m =NA, k =-1)splineBasis1Dpen(funDataObject, bs ="ps", m =NA, k =-1, parallel =FALSE)
Arguments
funDataObject: An object of class funData
containing the observed functional data samples and for which the basis decomposition is calculated.
bs: A character string, specifying the type of basis functions to be used. Defaults to "ps" (B-spline functions). Please refer to smooth.terms for a list of possible basis functions.
m: A numeric, the order of the spline basis. Defaults to NA, i.e. the order is chosen automatically. See s for details.
k: A numeric, the number of basis functions used. Defaults to -1, i.e. the number of basis functions is chosen automatically. See s for details.
parallel: Logical (only for splineBasis1Dpen. 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.
Returns
scores: A matrix of scores (coefficients) with dimension N x K, reflecting the weights for each of the K basis functions and for each of the N observations. - B: A matrix containing the scalar product of all pairs of basis functions.
ortho: Logical, set to FALSE, as basis functions are not orthonormal. - functions: NULL, as basis functions are known
settings: A list with entries bs, m and k, giving the actual parameters used for generating the spline basis functions.