fda.usc (version 1.5.0)

predict.fregre.gls: Predictions from a functional gls object

Description

The predictions for the functional generalized least squares fitted linear model represented by object are obtained at the covariate values defined in newx.

Usage

# S3 method for fregre.gls
predict(object, newx = NULL, type = "response",
    se.fit= FALSE, scale = NULL,df , interval = "none", 
    level = 0.95, weights = 1, pred.var, n.ahead = 1,  …)
# S3 method for fregre.igls
predict(object, new.fdataobj = NULL, data, 
          se.fit = FALSE, scale = NULL, df = df, interval = "none",
          level = 0.95, weights = 1, pred.var, n.ahead =1L,…)

Arguments

object

fregre.gls object.

newx,new.fdataobj

An optional data list in which to look for variables with which to predict. If omitted, the fitted values are used. List of new explanatory data.

type

Type of prediction (response or model term).

se.fit

=TRUE (not default) standard error estimates are returned for each prediction.

scale

Scale parameter for std.err. calculation.

df

Degrees of freedom for scale.

interval

Type of interval calculation.

level

Tolerance/confidence level.

weights

variance weights for prediction. This can be a numeric vector or a one-sided model formula. In the latter case, it is interpreted as an expression evaluated in newdata

pred.var

the variance(s) for future observations to be assumed for prediction intervals. See link{predict.lm} for more details.

data

Data frame with the time or spatinal index

n.ahead

number of steps ahead at which to predict.

Further arguments passed to or from other methods.

Value

a vector with the predicted values.

References

Oviedo de la Fuente, M., Febrero-Bande, M., Pilar Munoz, and Dominguez, A. Predicting seasonal influenza transmission using Functional Regression Models with Temporal Dependence. arXiv:1610.08718. https://arxiv.org/abs/1610.08718

See Also

fregre.gls

Examples

Run this code
# NOT RUN {
data(tecator)
ind<-1:129
x <-fdata.deriv(tecator$absorp.fdata,nderiv=1)
dataf=as.data.frame(tecator$y)
dataf$itime <- 1:nrow(x)
ldata=list("df"=dataf[ind,],"x"=x[ind])
newldata=list("df"=dataf[-ind,],"x"=x[-ind])
newy <- tecator$y$Fat[-ind]
ff <- Fat~x
res.gls=fregre.gls(ff,data=ldata, correlation=corAR1())
pred.gls <- predict.fregre.gls(res.gls,newldata)
par.cor <- list("cor.ARMA"=list("index"=c("itime"),"p"=1))
res.igls <- fregre.igls(ff,data=ldata,correlation=par.cor) 
pred.igls<-predict.fregre.igls(res.igls,newldata,data=newldata$df["index",drop=F])
# }

Run the code above in your browser using DataLab