Library: | times |
See also: | genexpar genbil genarma genarch |
Quantlet: | gentar | |
Description: | generates the threshold AR (TAR) process x that has the following form x_t = sum I{x_(t-thrlag) in (k_(i-1),k_i]}[phi_i(B)x_t]+e_t The sum goes from i=1 to nr (the number of threshold regions). I{} is an indicator function that takes the value 1 if the specified lagged value of x lies in the intervall (k_(i-1),k_i] and takes the value 0 otherwise. B denotes the backshift (or lag) operator and phi_i(B) is the lag polynom for the i'th threshold region. e_t is a sequence of independently distributed white noise with T > 99 observations. |
Usage: | x = gentar(nr,thrlag,thr,phi,e) | |
Input: | ||
nr | integer; total number of different threshold regions | |
thrlag | integer; threshold lag that specifies the x values for the indicator function | |
thr | (nr-1) x 1 vector that contains the thresholds k_i | |
phi | (nr*p) x 1 vector with the coefficients of the lag polynoms phi_i(B). The entries start with the coefficients for phi_1(B) and go up to phi_nr(B). | |
e | T x 1 vector with realizations of an independently distributed white noise process. | |
Output: | ||
x | T x 1 vector with the realizations of the generated TAR process |
library("times") ; loads the quantlets from times library randomize(03) ; sets a seed e = normal(600) ; generates the white noise realizations x = gentar(2,1,0,-0.75|0.75,e) timeplot(x[300:600]) ; plots the generated series
The example is a simple first-order threshold model with the two regions (-inf,0] and (0,inf). The display shows the generated series. Just compare this series with the simple AR(1) for phi=0.75.