predict.dma: Computes Predictions from 'dma' Model.

View source: R/other.methods.dma.R

predict.dmaR Documentation

Computes Predictions from dma Model.

Description

The function computes predictions based on the model obtained from fDMA.

Usage

## S3 method for class 'dma'
predict(object, newdata, type, ...)

Arguments

object

an object of dma class

newdata

a matrix as x object in fDMA

type

type="backward" computes predictions of y with the already estimated coefficients, but with x given by newdata, type="forward" computes predictions of y with the coefficients estimated in the last period, for various combinations of x given in rows of newdata

...

not used

Value

vector of forecasted values

Examples

wti <- crudeoil[-1,1]
drivers <- (lag(crudeoil[,-1],k=1))[-1,]
ld.wti <- (diff(log(wti)))[-1,]
ld.drivers <- (diff(log(drivers)))[-1,]

m1 <- fDMA(y=ld.wti,x=ld.drivers,alpha=0.99,lambda=0.99,initvar=1,model="dma")
p1 <- predict(object=m1,newdata=ld.drivers,type="backward")
p2 <- predict(object=m1,newdata=ld.drivers[1,],type="forward")
p3 <- predict(object=m1,newdata=ld.drivers[1:3,],type="forward")


fDMA documentation built on July 26, 2023, 6:09 p.m.

Related to predict.dma in fDMA...