predict.freg | R Documentation |
Prediction of FREG model
## S3 method for class 'freg' predict(object, ..., newdata = NULL)
object |
FREG model for which predictions are computed |
... |
additional arguments relevant for the generic method |
newdata |
an optional argument. Newdata should be organized as a list. The elements of the list
are covariates from FREG model, respectively. No data transformation is needed. Thus, functional covariates are entered in the list |
predictions of dependent variable y
library(fda) y = log10(apply(CanadianWeather$dailyAv[1:334,,2],2,sum)) x = CanadianWeather$dailyAv[1:334,,1] # temperature xbasis = create.fourier.basis(c(1,334),5) xfd = smooth.basis(c(1:335),x,xbasis)$fd bbasis = create.fourier.basis(c(1,334),5) latitude = CanadianWeather$coordinates[,1] longitude = CanadianWeather$coordinates[,2] xfdlist = list(xfd, latitude, longitude) cbasis = create.constant.basis(c(1,334)) betalist = list(bbasis, cbasis, cbasis) formula = y ~ xfd + latitude + longitude freg.model = freg(formula = formula, betalist = betalist) # Prediction with new data included newdata = list(CanadianWeather$dailyAv[1:365,,1], latitude, longitude) # newdata = list(xfd_1, latitude, longitude) #funct. and scalar variable(s) yhat = predict(freg.model, newdata = newdata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.