-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi,
I have been trying to use the fpca regression provided in this packet. However, after browsing the documentation, I have not yet been able to find an example of how to do it.
I have tried the following:
- Calling predict with the result of fpcr. For instance:
This does not work at all and throws the following error
library("refund") library("fda") fda_train = Data2fd(1:365, CanadianWeather$dailyAv[,1:25,1], create.fourier.basis(c(0,365),9)) fda_test = Data2fd(1:365, CanadianWeather$dailyAv[,26,1], create.fourier.basis(c(0,365),9)) y = CanadianWeather$coordinates[,1] predictor = fpcr(y[1:25], fdobj=fda_train, ncomp=5, store.gam = TRUE) predict(predictor, fdobj=fda_test)
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "fpcr" - Looking to work around this error, I tried to manually set the class of the object returned by
fpcrto "gam", which gets rid of the error but thenpredictreturns the prediction for the training dataset instead of the one provided in the call topredict.
I suspect that maybe calling predict with different parameters might solve these issues. However, I have tried several combinations to no avail. Could you please provide an example of the sequence of functions that have to be called to use the linear model created in pfcr as a predictor?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels