Page 1 of 1

Graph of transition

Posted: Wed Apr 13, 2016 10:33 am
by Hayet-
hello

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
the problem that: the value of the x axis take the date indeed it take the value of h

Graph of transition

Posted: Wed Apr 13, 2016 10:50 am
by TomDoan
If you're trying to do the threshold value against the transition function, use STYLE=DOTS, not STYLE=LINES. Because X isn't sorted, the lines will go all over the place.

If, instead, you're trying to do the transition function as a function of time, use GRAPH rather than SCATTER. However, unless your transition variable itself is fairly smooth, that graph might not look very good (switching quickly between 1's and 0's).

Re: Graph of transition

Posted: Wed Apr 13, 2016 4:35 pm
by Hayet-
hello
i change LINE by DOTS?
and the results is a ligne

Re: Graph of transition

Posted: Wed Apr 13, 2016 8:09 pm
by TomDoan
No. The result is a set of dots. If the X's are fairly dense, it will look a bit like a line. But you're graphing a smooth function, so it will be obvious what the shape is.