i try to represent the graphic of LSTAR /ESTAR, but the results is wrong
Code: Select all
CALENDAR(M) 1980:1
OPEN DATA "C:\Users\LAPTOP\Desktop\RATS\lnTCER-1980.RAT"
DATA(FORMAT=RATS) 1980:01 2015:07 lnTCER_Tunisie
stat lnTCER_Tunisie
*
*
GRAPH(STYLE=LINE,HEADER="séries des taux de change éffectif réel_Algérie") 1
# lnTCER_Tunisie
set y = lnTCER_Tunisie
set x = y-y{1}
@DFUNIT y
**optimal ordre of AR(p)
* The YuleLags procedure does a quick, efficient examination of a range
* of AR models for stationary data.
@yulelags(max=20) x
*
*
* The tests STAR
*
do d=1,9
@StarTest(p=1,d=d) x
end do d
*linear regression if linearity is accepted
*nlpar(exactlinesearch)
LINREG y
# Constant Y{1 to 5}
stats x
*compute scalef=1.0/sqrt(%variance)
*compute scalef=1.8
compute c=%mean,gamma=2.0
frml flstar = %logistic(gamma*(X{1}-c),1.0)
*frml festar = 1-exp(-gamma*(X{3}-c)^2)
*
nonlin(parmset=starparms) gamma c
*
* These are the two branches. Putting these in as linear equations makes
* specification more flexible---you can easily change the lag lists and
* the rest goes through as is.
*
*
equation standard x
# constant x{1 2 3}
equation transit x
# constant x{1 2 3}
*
* Convert the linear equations into FRML's with phi1 and phi2 as the
* coefficient vectors. Put them together with the transition function to
* make the STAR formula.
*
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star x = f=flstar,phi1f+f*phi2f
*
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
*
*estimate the model
*
nlls(parmset=regparms,frml=star) x
*
* Based upon the initial results, the standard equation is trimmed to
* just y{1} and transit to y{2 3 4 10 11} (The article shows lag 9
* rather than 10, but this specification fits quite a bit better). This
* is now estimated with all the parameters.
*
equation standard x
# constant y{1} x{1 2 3}
equation transit x
# constant y{1} x{1 2 3}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
*
*
* the new estimation, then including the STAR parameters
compute c=%mean,gamma=2.0
nlls(parmset=regparms+starparms,frml=star) x
*
print / x
*
print / h
**** représentation graphique d'un modèle LSTAR/ESTAR
set h = x{1}
set lstar = %logistic(2.1695*(h+0.0187),1.0)
scatter(header="LSTAR Model",style=line,vlabels="Theta")
# h lstar