ESTAR

Discussion of models with structural breaks or endogenous switching.
ef08kp
Posts: 11
Joined: Fri Jul 24, 2009 6:08 am

ESTAR

Unread post by ef08kp »

hi,

I am modelling real exchange rates for developing countries and to do that i am using Terasvirta's ESTAR models. Well, yes there exists a zipped folder that replicates terasvirta's 1994 results however the examples that are mentioned in the file are about LSTAR models. Neverthless when i ran the sample code for one of the files lynx.prg provided in the zippped folder ( data was also provided by the zipped folder) i didnt get the results as they are in the TERASVIRTA'S 1994 paper. Here is the code:
OPEN DATA "h:\settings\Personal\LYNX.xls"
CALENDAR(M) 1973
ALL 1982:04
DATA(FORMAT=XLS,ORG=COLUMNS) 1973:01 1982:04 lynx
set x = log(lynx)/log(10)
diff(center) x /xc
source startest.src
do d=1,9
@StarTest(p=11,d=d) xc
end do d
stats x
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=starparms) gamma c
frml flstar = %logistic(1.8*gamma*(x{3}-c),1.0)
compute c=%mean,gamma=2.0
equation standard x
# constant x{1 to 11}
equation transit x
# constant x{1 to 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star lynx = f=flstar,phi1f+f*phi2f
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star) x
stats %resids

I had the following queries:

1. i wasnt able to understand the underlined part of the code.
2. what all changes i need to make to run a code for a ESTAR model given i have done the linearity tests and my delay parameter (d)=1 and lags (p) =1.
3. Also why have the starting values for gamma taken as 2.

thank you
kumar somya
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ESTAR

Unread post by TomDoan »

ef08kp wrote:hi,

I am modelling real exchange rates for developing countries and to do that i am using Terasvirta's ESTAR models. Well, yes there exists a zipped folder that replicates terasvirta's 1994 results however the examples that are mentioned in the file are about LSTAR models. Neverthless when i ran the sample code for one of the files lynx.prg provided in the zippped folder ( data was also provided by the zipped folder) i didnt get the results as they are in the TERASVIRTA'S 1994 paper. Here is the code:
OPEN DATA "h:\settings\Personal\LYNX.xls"
CALENDAR(M) 1973
ALL 1982:04
DATA(FORMAT=XLS,ORG=COLUMNS) 1973:01 1982:04 lynx
set x = log(lynx)/log(10)
diff(center) x /xc
source startest.src
do d=1,9
@StarTest(p=11,d=d) xc
end do d
stats x
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=starparms) gamma c
frml flstar = %logistic(1.8*gamma*(x{3}-c),1.0)
compute c=%mean,gamma=2.0
equation standard x
# constant x{1 to 11}
equation transit x
# constant x{1 to 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star lynx = f=flstar,phi1f+f*phi2f
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star) x
stats %resids

I had the following queries:

1. i wasnt able to understand the underlined part of the code.
2. what all changes i need to make to run a code for a ESTAR model given i have done the linearity tests and my delay parameter (d)=1 and lags (p) =1.
3. Also why have the starting values for gamma taken as 2.

thank you
kumar somya
The lynx data set is annual from 1821 to 1934. You somehow got the dates different, and in the process, lost a couple of data points.

On reading the program, I noticed that the following should replace the two lines:

nonlin(parmset=starparms) gamma c
frml flstar = %logistic(1.8*gamma*(x{3}-c),1.0)

Code: Select all

*
* In practice, you would use the following:
*
compute scalef=1.0/sqrt(%variance)
*
* In order to help reproduce the published results, we're putting in
* a rounded value for scalef
*
compute scalef=1.8
nonlin(parmset=starparms) gamma c
frml flstar = %logistic(scalef*gamma*(x{3}-c),1.0)
Terasvirta used the rounded value of 1.8 (the calculated scalef is 1.79). The 1.8 is specific to this data set. For other data sets, you should use the more general formula with the calculated scalef.

1. Nothing seems to be underlined. Try just including the part of the code that you need explained.

2. An e-star replaces

frml flstar = %logistic(scalef*gamma*(x{d}-c),1.0)

with

frml festar = 1-exp(-scalef^2*gamma*(x{d}-c)^2)

using festar elsewhere in place of flstar.

3. That's explained in the comments. It's big enough to separate the data into regimes, but not so large that it's impossible for it to move. (If gamma starts too large, the transition function will be either 0 or 1 at almost every data point, and the derivative with respect to gamma will be zero).
ef08kp
Posts: 11
Joined: Fri Jul 24, 2009 6:08 am

Re: ESTAR

Unread post by ef08kp »

Hi, the part of the that i didnt understand is:

frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star lynx = f=flstar,phi1f+f*phi2f
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star) x
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ESTAR

Unread post by TomDoan »

ef08kp wrote:Hi, the part of the that i didnt understand is:

frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star lynx = f=flstar,phi1f+f*phi2f
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star) x
There are two branches, which here are called standard and transit. The instruction

frml(equation=xxx,vector=yyy) zzz

translates the linear equation xxx into the non-linear formula zzz, and writes the formula using the vector yyy in place of the coefficients from the linear equation. For instance,

equation transit x
# x{2 3 4 10 11}
frml(equation=transit ,vector=phi2) phi2f

creates the formula phi2f which will have the form phi2(1)*x(t-2)+phi2(2)*x(t-3)+phi2(3)*x(t-4)+phi2(4)*x(t-10)+phi2(5)*x(t-11). As you can see, it's a lot easier to do this by defining the linear equation and translating, than by direct coding.


frml star lynx = f=flstar,phi1f+f*phi2f

takes the two branches and combines them based upon the value of the transition function flstar.


nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star) x

The first of these estimates only the regression parameters holding the "star" parameters fixed. The second then estimates all the parameters together.
ef08kp
Posts: 11
Joined: Fri Jul 24, 2009 6:08 am

Re: ESTAR

Unread post by ef08kp »

thanks for such a lucid reply on the code. I gave the following code after making amends:
OPEN DATA "H:\LYNX.xls"
CALENDAR(A) 1821
ALL 1934:01
DATA(FORMAT=XLS,ORG=COLUMNS) 1821:01 1934:01 lynx
set x = log(lynx)/log(10)
diff(center) x / xc
source startest.src
do d=1,9
@StarTest(p=11,d=d) x
end do d
stats x
compute scalef=1.8
nonlin(parmset=starparms) gamma c
frml flstar = %logistic(scalef*gamma*(x{3}-c),1.0)
compute c=%mean,gamma=2.0
equation standard x
# constant x{1 to 11}
equation transit x
# constant x{1 to 11}
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
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star)
equation standard x
# x{1}
equation transit x
# x{2 3 4 9 11}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
nlls(parmset=regparms,frml=star) x
nlls(parmset=regparms+starparms,frml=star)
stats %resids

and the output that i get as it is:

Test for STAR in series X. AR length=11 delay=1
Test F-stat Signif
Linearity 0.6226741 0.9271
H01 0.8351087 0.6063
H02 0.3655942 0.9649
H03 0.7644539 0.6737


Test for STAR in series X. AR length=11 delay=2
Test F-stat Signif
Linearity 1.5076229 0.0867
H01 1.7991184 0.0760
H02 0.9573417 0.4931
H03 1.4592817 0.1643


Test for STAR in series X. AR length=11 delay=3
Test F-stat Signif
Linearity 2.8824584 0.0002
H01 2.2799061 0.0221
H02 2.3245568 0.0174
H03 2.4749249 0.0103


Test for STAR in series X. AR length=11 delay=4
Test F-stat Signif
Linearity 1.9044282 0.0165
H01 1.1929929 0.3131
H02 2.1628094 0.0270
H03 1.9060830 0.0510


Test for STAR in series X. AR length=11 delay=5
Test F-stat Signif
Linearity 0.8415018 0.6990
H01 0.6361525 0.7902
H02 1.3661956 0.2096
H03 0.6105938 0.8145


Test for STAR in series X. AR length=11 delay=6
Test F-stat Signif
Linearity 0.7460010 0.8156
H01 0.7723175 0.6655
H02 0.9446770 0.5044
H03 0.5824690 0.8376


Test for STAR in series X. AR length=11 delay=7
Test F-stat Signif
Linearity 1.6187611 0.0554
H01 2.5273400 0.0116
H02 0.8101852 0.6298
H03 1.0807723 0.3876


Test for STAR in series X. AR length=11 delay=8
Test F-stat Signif
Linearity 2.5687501 0.0009
H01 1.3373657 0.2290
H02 3.1913891 0.0016
H03 2.1720057 0.0244


Test for STAR in series X. AR length=11 delay=9
Test F-stat Signif
Linearity 1.5465760 0.0742
H01 1.2962767 0.2509
H02 1.3118699 0.2375
H03 1.7974375 0.0685


Statistics on Series X
Annual Data From 1821:01 To 1932:01
Observations 112
Sample Mean 2.911441 Variance 0.313933
Standard Error 0.560297 of Sample Mean 0.052943
t-Statistic (Mean=0) 54.991860 Signif Level 0.000000
Skewness -0.403384 Signif Level (Sk=0) 0.085531
Kurtosis (excess) -0.686422 Signif Level (Ku=0) 0.150763
Jarque-Bera 5.236230 Signif Level (JB=0) 0.072940

## NL6. NONLIN Parameter PHI1(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(2) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(3) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(4) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(5) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(6) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(7) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(8) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(9) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(10) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(11) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI1(12) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(2) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(3) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(4) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(5) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(6) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(7) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(8) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(9) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(10) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(11) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(12) Has Not Been Initialized. Trying 0

Nonlinear Least Squares - Estimation by Gauss-Newton
Convergence in 2 Iterations. Final criterion was 0.0000000 <= 0.0000100
Dependent Variable X
Annual Data From 1821:01 To 1932:01
Usable Observations 101 Degrees of Freedom 77
Total Observations 112 Skipped/Missing 11
Centered R**2 0.930436 R Bar **2 0.909657
Uncentered R**2 0.997536 T x R**2 100.751
Mean of Dependent Variable 2.8941247428
Std Error of Dependent Variable 0.5573387988
Standard Error of Estimate 0.1675198835
Sum of Squared Residuals 2.1608441764
Regression F(23,77) 44.7780
Significance Level of F 0.00000000
Log Likelihood 50.84060
Durbin-Watson Statistic 1.962900

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. PHI1(1) 0.046850178 0.546116792 0.08579 0.93185776
2. PHI1(2) 0.692967777 0.180597498 3.83708 0.00025341
3. PHI1(3) 0.400529640 0.242210451 1.65364 0.10227157
4. PHI1(4) 0.256605423 0.263717264 0.97303 0.33358410
5. PHI1(5) -0.195698901 0.236042887 -0.82908 0.40962079
6. PHI1(6) -0.069392486 0.260043785 -0.26685 0.79029861
7. PHI1(7) 0.157233615 0.290870401 0.54056 0.59036948
8. PHI1(8) -0.301547093 0.304192476 -0.99130 0.32464232
9. PHI1(9) 0.366941977 0.277727393 1.32123 0.19033716
10. PHI1(10) 0.105380885 0.265373182 0.39710 0.69238898
11. PHI1(11) -0.306078863 0.265565287 -1.15256 0.25265831
12. PHI1(12) 0.079548643 0.196132783 0.40559 0.68617187
13. PHI2(1) -1.929499818 1.009423698 -1.91149 0.05966309
14. PHI2(2) 0.796581701 0.271502136 2.93398 0.00440749
15. PHI2(3) -1.767519848 0.414412959 -4.26512 0.00005620
16. PHI2(4) 1.500593248 0.450620337 3.33006 0.00133484
17. PHI2(5) -0.324800754 0.466707307 -0.69594 0.48856109
18. PHI2(6) 0.472362414 0.473092728 0.99846 0.32118557
19. PHI2(7) -0.490538185 0.484736996 -1.01197 0.31472293
20. PHI2(8) 0.524911595 0.477433765 1.09944 0.27500016
21. PHI2(9) -0.660001005 0.428497568 -1.54027 0.12759482
22. PHI2(10) -0.009860803 0.394758103 -0.02498 0.98013605
23. PHI2(11) 0.898063449 0.399116231 2.25013 0.02729566
24. PHI2(12) -0.697649696 0.292277363 -2.38694 0.01944326

## NL6. NONLIN Parameter PHI1(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(2) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(3) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(4) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(5) Has Not Been Initialized. Trying 0

Nonlinear Least Squares - Estimation by Gauss-Newton
Convergence in 2 Iterations. Final criterion was 0.0000000 <= 0.0000100
Dependent Variable X
Annual Data From 1821:01 To 1932:01
Usable Observations 101 Degrees of Freedom 95
Total Observations 112 Skipped/Missing 11
Centered R**2 0.909280 R Bar **2 0.904506
Uncentered R**2 0.996787 T x R**2 100.675
Mean of Dependent Variable 2.8941247428
Std Error of Dependent Variable 0.5573387988
Standard Error of Estimate 0.1722296646
Sum of Squared Residuals 2.8179904495
Log Likelihood 37.43158
Durbin-Watson Statistic 1.905887

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. PHI1(1) 1.142538637 0.012196342 93.67880 0.00000000
2. PHI2(1) -0.954242884 0.151577881 -6.29540 0.00000001
3. PHI2(2) 1.210845204 0.254671072 4.75455 0.00000707
4. PHI2(3) -0.455332955 0.156074429 -2.91741 0.00440493
5. PHI2(4) 0.484065331 0.086286485 5.60998 0.00000020
6. PHI2(5) -0.554868492 0.108473253 -5.11526 0.00000163


Nonlinear Least Squares - Estimation by Gauss-Newton
Convergence in 8 Iterations. Final criterion was 0.0000023 <= 0.0000100
Dependent Variable X
Annual Data From 1821:01 To 1932:01
Usable Observations 101 Degrees of Freedom 93
Total Observations 112 Skipped/Missing 11
Centered R**2 0.913390 R Bar **2 0.906871
Uncentered R**2 0.996932 T x R**2 100.690
Mean of Dependent Variable 2.8941247428
Std Error of Dependent Variable 0.5573387988
Standard Error of Estimate 0.1700831168
Sum of Squared Residuals 2.6903287959
Log Likelihood 39.77279
Durbin-Watson Statistic 2.028622

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. PHI1(1) 1.159984554 0.023541082 49.27490 0.00000000
2. PHI2(1) -0.807993894 0.148388424 -5.44513 0.00000042
3. PHI2(2) 0.956917201 0.244847549 3.90822 0.00017638
4. PHI2(3) -0.343980467 0.138167875 -2.48958 0.01456587
5. PHI2(4) 0.490987063 0.072463848 6.77561 0.00000000
6. PHI2(5) -0.545143976 0.092709187 -5.88015 0.00000006
7. GAMMA 2.285645135 0.659173986 3.46744 0.00079750
8. C 2.723728365 0.084779610 32.12716 0.00000000

## NL6. NONLIN Parameter PHI1(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(1) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(2) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(3) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(4) Has Not Been Initialized. Trying 0
## NL6. NONLIN Parameter PHI2(5) Has Not Been Initialized. Trying 0

Nonlinear Least Squares - Estimation by Gauss-Newton
Convergence in 2 Iterations. Final criterion was 0.0000000 <= 0.0000100
Dependent Variable X
Annual Data From 1821:01 To 1932:01
Usable Observations 101 Degrees of Freedom 95
Total Observations 112 Skipped/Missing 11
Centered R**2 0.902665 R Bar **2 0.897542
Uncentered R**2 0.996553 T x R**2 100.652
Mean of Dependent Variable 2.8941247428
Std Error of Dependent Variable 0.5573387988
Standard Error of Estimate 0.1783985751
Sum of Squared Residuals 3.0234749028
Log Likelihood 33.87725
Durbin-Watson Statistic 2.011131

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. PHI1(1) 1.155674270 0.014666137 78.79882 0.00000000
2. PHI2(1) -0.773769977 0.136785652 -5.65681 0.00000016
3. PHI2(2) 0.876553512 0.223035415 3.93011 0.00016114
4. PHI2(3) -0.368373534 0.134089827 -2.74721 0.00719149
5. PHI2(4) 0.278688670 0.049503364 5.62969 0.00000018
6. PHI2(5) -0.248361702 0.071517803 -3.47273 0.00077736


Nonlinear Least Squares - Estimation by Gauss-Newton
Convergence in 6 Iterations. Final criterion was 0.0000046 <= 0.0000100
Dependent Variable X
Annual Data From 1821:01 To 1932:01
Usable Observations 101 Degrees of Freedom 93
Total Observations 112 Skipped/Missing 11
Centered R**2 0.903029 R Bar **2 0.895730
Uncentered R**2 0.996565 T x R**2 100.653
Mean of Dependent Variable 2.8941247428
Std Error of Dependent Variable 0.5573387988
Standard Error of Estimate 0.1799698309
Sum of Squared Residuals 3.0121900226
Log Likelihood 34.06609
Durbin-Watson Statistic 2.061257

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. PHI1(1) 1.169360994 0.029439254 39.72115 0.00000000
2. PHI2(1) -0.789160172 0.164712475 -4.79114 0.00000626
3. PHI2(2) 0.873681809 0.265570256 3.28983 0.00141680
4. PHI2(3) -0.360429543 0.146655851 -2.45766 0.01583761
5. PHI2(4) 0.280102578 0.051210224 5.46966 0.00000038
6. PHI2(5) -0.256835479 0.074474964 -3.44862 0.00084838
7. GAMMA 1.942275628 0.659495280 2.94509 0.00407859
8. C 2.683908029 0.114926704 23.35322 0.00000000

again i am not getting results in the paper. Also the when you mention the following instruction:
equation standard x
# x{1}
equation transit x
# x{2 3 4 10 11}
does it mean at lag 1there is standard estimation and lags 2 to 11 transition take places between regimes therefore nonlinear.

thank you
kumar
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ESTAR

Unread post by TomDoan »

You're still two observations short, presumably in your data file.

I wouldn't be that concerned about being able to reproduce results out of papers. In general, we have a very hard time ever matching results unless we can get both the data and the program. There are too many minor decisions that don't get documented within the paper that affect the results.

The "standard" model is the branch that applies where the transition function is 0. When the transition function is 1, it's the sum of the standard and the transit.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ESTAR

Unread post by TomDoan »

I read through my correspondence with Prof. Teräsvirta regarding the results in the paper. STAR models are very tricky to fit, and have many local modes. He re-ran one of his models with more modern optimization code and got different (better) results. The RATS code for estimating these is correct; but RATS, and any other optimizer, is going to be sensitive to guess values when the objective function is multi-modal.
ef08kp
Posts: 11
Joined: Fri Jul 24, 2009 6:08 am

Re: ESTAR

Unread post by ef08kp »

I was estimating the an estar model for yen dollar ( CPI based) real effective exchange rate with P =1 and d=1 ( the lag and delay parameter respectively). could you please just check the code below as i was not getting right results given i was practising on a paper that has used the same dataset for yen dollar exchange rate for the same period. Could the problem be starting value of gamma ?
OPEN DATA "h:\settings\Personal\jpus.xls"
CALENDAR(M) 1973
ALL 1996:12
DATA(FORMAT=XLS,ORG=COLUMNS) 1973:01 1996:12 reer
set x = reer
source startest.src
do d=1,9
@StarTest(p=1,d=d) x
end do d
stats x
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=starparms) gamma c
frml festar = 1-exp(-scalef^2*gamma*(x{1}-c)^2)
compute c=%mean,gamma=1.0
equation standard x
# constant x{1}
equation transit x
# constant x{1}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
frml star x = f=festar,phi1f+f*phi2f
nonlin(parmset=regparms) phi1 phi2
nonlin(parmset=starparms) gamma c
nlls(parmset=regparms,frml=star) x
equation standard x
# x{1}
equation transit x
# x{1}
frml(equation=standard,vector=phi1) phi1f
frml(equation=transit ,vector=phi2) phi2f
compute c=%mean,gamma=1.0
nlls(parmset=regparms+starparms,frml=star,trace) x

thank you
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ESTAR

Unread post by TomDoan »

If you have the same data set, you should be able to reproduce the published results by feeding in the published gamma and c. (Given those, the model is linear). It's possible that either the published result or the one you're getting is a local mode rather than the global one - since this is a non-linear least squares model, the one with the higher sum of squared residuals is the "wrong" mode.
Post Reply