Learn R Programming

pfica (version 0.1.0)

pspline.kffobi: P-Spline smoothed functional ICA

Description

This function provides an alternative form of computing the smoothed functional ICA in terms of principal components (function kffobi), using a discrete penalty that measures the roughness of principal factors by summing squared r-order differences between adjacent B-spline coefficients (P-spline penalty); see Aguilera and Aguilera-Morillo (2013) for a detailed discussion.

Usage

pspline.kffobi(fdx, ncomp = fdx$basis$nbasis, rho = 0, r = 2,
               pr = c("fdx", "fdx.st", "KL", "KL.st"),
               center = FALSE, plotfd = FALSE)

Arguments

fdx

a functional data object obtained from the fda package.

ncomp

number of independent components to compute.

rho

the smoothing parameter. It can be estimated by leave-one-out cross-validation.

r

a number indicating the order of the penalty.

pr

the functional data object to project into the space spanned by the eigenfunctions of the FOBI operator. To compute the independent components, the usual procedure is to use KL.st, the standardized principal component expansion. Thus, if pr is not supplied, then KL.st is used.

center

a logical value indicating whether the mean function has to be subtracted from each functional observation.

plotfd

a logical value indicating whether to plot the eigenfunctions of the FOBI operator.

Value

a list with the following named entries:

eigenbasis

a functional data object for the eigenfunctions or independent factors.

kurtosis

a numeric vector giving the kurtosis associated to each independent component vector.

scores

a matrix whose column vectors are the independent components.

Details

The smooth FPCA can be summarized in the following generalized matrix eigenproblem: $$n^{-1}Vc=\lambda(G+\rho G_{r})c,$$ with \(V\) as the covariance matrix of \(A\); see Details in kffobi. Then, the matrix of penalties \(G_{r}\) is defined as \(G_{r}=\left(\Delta^{r}\right)^{\prime} \Delta^{r}\) with \(\Delta^{r}\) as the matrix representation of the r-order difference operator. For \(r=2\) this matrix is given by $$\Delta^{2}=\left[\begin{array}{ccccc} 1 & -2 & 1 & 0 & \cdots \\ 0 & 1 & -2 & 1 & \cdots \\ 0 & 0 & 1 & -2 & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \end{array}\right].$$ In R, this can be translated into the following code: \(\Delta^{2}=\mathtt{diff(diag(nknots+2), differences = 2)}\), where nknots is the number of basis knots.

Once the P-spline approximation of eigenfunctions has been computed and the smooth principal component expansion of P-splines is obtained, then the ICA procedure is conducted. As in kffobi, the functional ICA of the principal component expansion is equivalent to the ICA of the matrix \(Z\); see Details in kffobi.

References

Aguilera, AM. and MC. Aguilera-Morillo (2013). <U+201C>Penalized PCA approaches for B-spline expansions of smooth functional data<U+201D>. In: Applied Mathematics and Computation 219(14), pp. 7805<U+2013>7819.

Ramsay, J. and B. Silverman (2005). Functional Data Analysis. Springer.

Vidal, M. (2020). Functional Independent Component Analysis in Bioelectrical Signal Processing. MA thesis. Universidad de Granada.

See Also

kffobi

Examples

Run this code
# NOT RUN {
## Canadian Weather data
library(fda)
arg <- 1:365
Temp <- CanadianWeather$dailyAv[,,1]
B <- create.bspline.basis(rangeval=c(min(arg),max(arg)), nbasis=16)
x <- Data2fd(Temp, argvals = arg, B)
ica.fd <- pspline.kffobi(x, 16, rho = 10)
## Plot by region: classification in order of maximum kurtosis
k1 <- which.max(ica.fd$kurtosis)
k2 <- which.max(ica.fd$kurtosis[c(-k1)])+1
sc <- ica.fd$scores
plot(sc[,c(k1)], sc[,c(k2)], ylab = "", xlab = "")
text(sc[,c(k1)], sc[,c(k2)], CanadianWeather$region, pch=0.5, cex=0.6)
# }

Run the code above in your browser using DataLab