Threshold determination
Posted: Sat Feb 15, 2014 5:26 am
Hi,
i am looking to estimate a TAR model and to search for the threshold value of the dependent variable using the Chan (1993) methodology*.
I try the following code:
vector(67) ssr_result
for !i=1 to 67
genr h_!i=0
genr tau_!i=@elem(y, !i)
smpl 2 67 if y(-1)>=tau_!i
genr h_!i=1
smpl 2 67
equation tar_{!i}.ls d(y)=c(1)*h_!i*((y(-1)-tau_!i))+c(2)*(1-h_!i)*((y(-1)-tau_!i))+c(3)*d(y(-1))
scalar ssr_{!i}=@ssr
ssr_result(!i)=@ssr
next
(I have sorted and trimmed the observations before running this code). However, i get an error message for "genr tau ...." i think there may be more errors with this code; i am very new to programming so apologies if the whole code is incorrect!
*Chan, K. S. (1993), "Consistency and Limiting Distribution of the Least Squares Estimator of a Threshold Autoregressive Model," The Annals of Statistics, 21, 520-533
i am looking to estimate a TAR model and to search for the threshold value of the dependent variable using the Chan (1993) methodology*.
I try the following code:
vector(67) ssr_result
for !i=1 to 67
genr h_!i=0
genr tau_!i=@elem(y, !i)
smpl 2 67 if y(-1)>=tau_!i
genr h_!i=1
smpl 2 67
equation tar_{!i}.ls d(y)=c(1)*h_!i*((y(-1)-tau_!i))+c(2)*(1-h_!i)*((y(-1)-tau_!i))+c(3)*d(y(-1))
scalar ssr_{!i}=@ssr
ssr_result(!i)=@ssr
next
(I have sorted and trimmed the observations before running this code). However, i get an error message for "genr tau ...." i think there may be more errors with this code; i am very new to programming so apologies if the whole code is incorrect!
*Chan, K. S. (1993), "Consistency and Limiting Distribution of the Least Squares Estimator of a Threshold Autoregressive Model," The Annals of Statistics, 21, 520-533