## Canadian Weather data
library(fda)
arg <- 1:365
Temp <- CanadianWeather$dailyAv[,,1]
B <- create.bspline.basis(rangeval=c(min(arg),max(arg)), nbasis=14)
x <- Data2fd(Temp, argvals = arg, B)
#plot(x) #plot data
Lfdobj <- int2Lfd(max(0, norder(B)-2))
penf <- fdPar(B, Lfdobj, lambda=10^9) #penalty parameter (lambda)
ica.fd <- kffobi(x, 2, eigenfPar = penf, w="ZCA-cor")
## Whitened data using the two first smoothed principal components
wKL <- ica.fd$wKL
## Plot by region
sc <- ica.fd$ICA.scores
plot(sc[,1], sc[,2], pch = 20, col = factor(CanadianWeather$region),
ylab = "IC 1", xlab = "IC 2")
Run the code above in your browser using DataLab