differences in variable(i)

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
Aaron
Posts: 11
Joined: Thu Nov 07, 2013 2:42 pm

differences in variable(i)

Unread post by Aaron »

Dear All,

I am writing a code to estimate a threshold cointegration model.
In the below code, "thresh_test(i)" creates an error. If just a series from the attached data set used, for example r_10, the program works.
What is the problem? How can I resolve this issue?

Thank you very much. :D

------------------------

Code: Select all

cal(m) 1955
all 1998:12
open data tres_coint_o.xls
data(format=xls,org=obs)

linreg r_short 1964:01 1998:12 mu; # constant r_10
dif mu / dmu 
*
*
*
compute low = fix(%nobs*.15) , high = fix(%nobs*.85)
set thresh_test = mu
order thresh_test
compute thresh = thresh_test(low)

compute rss_test = 1000000.0
do i = low,high
   set yy      = mu - thresh_test(i)
   set flag    = %if(yy{1}<0,0,1)
   set minus   = 1 - flag
   set z_plus  = flag*yy{1}
   set z_minus = minus*yy{1}

   lin(noprint) dmu 
   # z_plus z_minus; * use the selected lag

   if %rss < rss_test {
      compute rss_test = %rss
      compute thresh = thresh_test(i)
   }
end do I
dis ' Threshold = ' thresh
------------------------

Aaron
Attachments
tres_coint_o.xls
(52.5 KiB) Downloaded 706 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: differences in variable(i)

Unread post by TomDoan »

You might want to look at Enders-Siklos since that's what you're doing.

The problem that you're running into is that you're running the regression well into the data set so <<low>> and <<high>> aren't correct. Change them to:

compute low = %regstart()+fix(%nobs*.15) , high = %regstart()+fix(%nobs*.85)

which will relocate them into the actual data range.
Aaron
Posts: 11
Joined: Thu Nov 07, 2013 2:42 pm

Re: differences in variable(i)

Unread post by Aaron »

Dear Tom,

Thank you very much for your help. I am also looking at the procedure.

Sincerely,

Aaron
Post Reply