package “fdapace” (R) - create a functional plot of the first principal component

拟墨画扇 提交于 2019-12-13 03:46:22

问题


My question is about functional principal component analysis in R. I am working with a multi-dimensional time series looking something like this:

My goal is to reduce the dimensions by applying functional PCA and then plot the first principal component like this:

I have already used the FPCA function of the fdapace package on the dataset. Unfortunately, I don't understand how to interpret the resulting matrix of the FPCA estimates (xiEst). In my understanding the values of the Principal components are stored in the columns of the matrix.
Unfortunately the number of columns doesn't fit the number of time intervals of my multi dimensional time series. I don't know how the values in the matrix correspond to the values of the original data and how to plot the first principal component as a dimensional reduction of the original data.

If you need some code to reproduce the situation you can use the medfly dataset of the package:

library(fdapace)
data(medfly25)
Flies <- MakeFPCAInputs(medfly25$ID, medfly25$Days, medfly25$nEggs)
pfcaObjFlies <- FPCA(Flies$Ly, Flies$Lt)

when I plot the first principal component via

plot(fpcaObjFlies$xiEst[,1], type = "o")

the graph doesn't really fit my expectations:

I would have expected a graph with 25 observations similar to the graphs of the medfly dataset.

来源:https://stackoverflow.com/questions/52243613/package-fdapace-r-create-a-functional-plot-of-the-first-principal-componen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!