predict.TAR {TSA}R Documentation

Prediction based on a fitted TAR model

Description

Predictions based on a fitted TAR model. The errors are assumed to be normally distributed. The predictive distributions are approximated by simulation.

Usage

## S3 method for class 'TAR'
predict(object, n.ahead = 1, n.sim = 1000,...)

Arguments

object

a fitted TAR model from the tar function

n.ahead

number of prediction steps ahead

n.sim

simulation size

...

other arguments; not used here but kept for consistency with the generic method

Value

fit

a vector of medians of the 1-step to n.ahead-step predictive distributions

pred.interval

a matrix whose i-th row consists of the 2.5 and 97.5 precentiles of the i-step predictive distribution

pred.matrix

a matrix whose j-th column consists of all simulated values from the j-step predictive distribution

Author(s)

Kung-Sik Chan

References

"Time Series Analysis, with Applications in R" by J.D. Cryer and K.S. Chan

See Also

tar

Examples

data(prey.eq)
prey.tar.1=tar(y=log(prey.eq),p1=4,p2=4,d=3,a=.1,b=.9,print=TRUE)
set.seed(2357125)
pred.prey=predict(prey.tar.1,n.ahead=60,n.sim=1000)
yy=ts(c(log(prey.eq),pred.prey$fit),frequency=1,start=1)
plot(yy,type='n',ylim=range(c(yy,pred.prey$pred.interval)),ylab='Log Prey',
xlab=expression(t))
lines(log(prey.eq))
lines(window(yy, start=end(prey.eq)[1]+1),lty=2)
lines(ts(pred.prey$pred.interval[2,],start=end(prey.eq)[1]+1),lty=2)
lines(ts(pred.prey$pred.interval[1,],start=end(prey.eq)[1]+1),lty=2)

[Package TSA version 1.3.1 Index]