# predict.TAR: Prediction based on a fitted TAR model In TSA: Time Series Analysis

## Description

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

## Usage

 ```1 2``` ```## 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

Kung-Sik Chan

## References

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

`tar`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```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) ```

### Example output

```Attaching package: 'TSA'

The following objects are masked from 'package:stats':

acf, arima

The following object is masked from 'package:utils':

tar

time series included in this analysis is:  log(prey.eq)
SETAR(2, 1 , 4 ) model delay = 3
estimated threshold =  4.661  from a Minimum AIC  fit with thresholds
searched from the  17  percentile to the   81  percentile of all data.
The estimated threshold is the  56.6  percentile of
all data.
lower regime:
Residual Standard Error=0.2341
R-Square=0.9978
F-statistic (df=2, 28)=6355.76
p-value=0

Estimate Std.Err t-value Pr(>|t|)
intercept-log(prey.eq)   0.2621  0.3156  0.8305   0.4133
lag1-log(prey.eq)        1.0175  0.0704 14.4455   0.0000

(unbiased) RMS
0.05479
with no of data falling in the regime being
log(prey.eq) 30

(max. likelihood) RMS for each series (denominator=sample size in the regime)
log(prey.eq) 0.05114

upper regime:
Residual Standard Error=0.2676
R-Square=0.9971
F-statistic (df=5, 18)=1253.556
p-value=0

Estimate Std.Err t-value Pr(>|t|)
intercept-log(prey.eq)   4.1986  1.2841  3.2697   0.0043
lag1-log(prey.eq)        0.7081  0.2023  3.5005   0.0026
lag2-log(prey.eq)       -0.3009  0.3118 -0.9648   0.3474
lag3-log(prey.eq)        0.2788  0.4063  0.6861   0.5014
lag4-log(prey.eq)       -0.6113  0.2726 -2.2427   0.0377

(unbiased) RMS
0.07158
with no of data falling in the regime being
23

(max. likelihood) RMS for each series (denominator=sample size in the regime)
0.05602

Nominal AIC is  10.92
```

TSA documentation built on July 2, 2018, 1:04 a.m.