ESTR modelling in a non linear System
ESTR modelling in a non linear System
Hi there,
I want to apply an ESTR model within a nonlinear system. To be more precise I have two equations whch I would like to estimate jointly bei NLS. I tried to use the following code
compute gstart = 1973:01
compute gend = 2009:12
set z = LJ_US-e
set d = z-z(1)
set y = e-e(1)
set x = LJ_US-LJ_US(1)
compute lamda1 = %mean, gamma=2.0 , lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z{2}-lamda1)^2) - Definition Transistion functions
frml transfct2 = 1-exp(-scalef^2*gamma1*(z{2}-lamda2)^2)
frml strgl1 y = mu1 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T)) - Equation 1
frml strgl2 x = mu0 + alpha1*d(T-1)+ (mu1+alpha2*transfct2(T)) - Equation 2
compute mu0=0,mu1=0, alpha1=alpha2,gamma=2, lambda1=lamda2=0,alpha3=alpha4 - Initial values
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest) gstart gend
The problem is that the procedure isnt working. Iam not quite sure about the last line of the code. After running I get the following output
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 0.000000 0.000000 0.00000 0.00000000
2. MU1 0.000000 0.000000 0.00000 0.00000000
3. ALPHA1 0.000000 0.000000 0.00000 0.00000000
4. ALPHA2 0.000000 0.000000 0.00000 0.00000000
5. GAMMA1 0.000000 0.000000 0.00000 0.00000000
6. MU1 0.000000 0.000000 0.00000 0.00000000
7. ALPHA3 0.000000 0.000000 0.00000 0.00000000
8. ALPHA4 0.000000 0.000000 0.00000 0.00000000
9. GAMMA2 0.000000 0.000000 0.00000 0.00000000
If I write nonlin mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2 in the beginning
and nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) gstart gend
in the end I get the message
SIGMA Is Singular/Not PSD At Row 1. Too Many Equations for Data Set Size?
I hav learnt from the Handbook that the dependent varaible has to be included in the nonlin command. However it is not quite clear how to specify the last row. I also tried nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) / x y gstart gend but got the output "## SX22. Expected Type FRML, Got SERIES Instead>>>>dow=neweywest) / x <<<<"
However, I have no idea how to solve this problem as i don`t know how to specify the last row. Any help will be appreciated. Thanks you!!!!!
I want to apply an ESTR model within a nonlinear system. To be more precise I have two equations whch I would like to estimate jointly bei NLS. I tried to use the following code
compute gstart = 1973:01
compute gend = 2009:12
set z = LJ_US-e
set d = z-z(1)
set y = e-e(1)
set x = LJ_US-LJ_US(1)
compute lamda1 = %mean, gamma=2.0 , lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z{2}-lamda1)^2) - Definition Transistion functions
frml transfct2 = 1-exp(-scalef^2*gamma1*(z{2}-lamda2)^2)
frml strgl1 y = mu1 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T)) - Equation 1
frml strgl2 x = mu0 + alpha1*d(T-1)+ (mu1+alpha2*transfct2(T)) - Equation 2
compute mu0=0,mu1=0, alpha1=alpha2,gamma=2, lambda1=lamda2=0,alpha3=alpha4 - Initial values
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest) gstart gend
The problem is that the procedure isnt working. Iam not quite sure about the last line of the code. After running I get the following output
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 0.000000 0.000000 0.00000 0.00000000
2. MU1 0.000000 0.000000 0.00000 0.00000000
3. ALPHA1 0.000000 0.000000 0.00000 0.00000000
4. ALPHA2 0.000000 0.000000 0.00000 0.00000000
5. GAMMA1 0.000000 0.000000 0.00000 0.00000000
6. MU1 0.000000 0.000000 0.00000 0.00000000
7. ALPHA3 0.000000 0.000000 0.00000 0.00000000
8. ALPHA4 0.000000 0.000000 0.00000 0.00000000
9. GAMMA2 0.000000 0.000000 0.00000 0.00000000
If I write nonlin mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2 in the beginning
and nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) gstart gend
in the end I get the message
SIGMA Is Singular/Not PSD At Row 1. Too Many Equations for Data Set Size?
I hav learnt from the Handbook that the dependent varaible has to be included in the nonlin command. However it is not quite clear how to specify the last row. I also tried nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) / x y gstart gend but got the output "## SX22. Expected Type FRML, Got SERIES Instead>>>>dow=neweywest) / x <<<<"
However, I have no idea how to solve this problem as i don`t know how to specify the last row. Any help will be appreciated. Thanks you!!!!!
Re: ESTR modelling in a non linear System
On your NLSYSTEM:Gilbril wrote:Hi there,
I want to apply an ESTR model within a nonlinear system. To be more precise I have two equations whch I would like to estimate jointly bei NLS. I tried to use the following code
If I write nonlin mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2 in the beginningCode: Select all
compute gstart = 1973:01 compute gend = 2009:12 set z = LJ_US-e set d = z-z(1) set y = e-e(1) set x = LJ_US-LJ_US(1) compute lamda1 = %mean, gamma=2.0 , lamda2 = %mean compute scalef=1.0/sqrt(%variance) nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu1 alpha3 alpha4 gamma2 frml transfct1 = 1-exp(-scalef^2*gamma1*(z{2}-lamda1)^2) - Definition Transistion functions frml transfct2 = 1-exp(-scalef^2*gamma1*(z{2}-lamda2)^2) frml strgl1 y = mu1 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T)) - Equation 1 frml strgl2 x = mu0 + alpha1*d(T-1)+ (mu1+alpha2*transfct2(T)) - Equation 2 compute mu0=0,mu1=0, alpha1=alpha2,gamma=2, lambda1=lamda2=0,alpha3=alpha4 - Initial values nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest) gstart gend
and nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) gstart gend
in the end I get the message
SIGMA Is Singular/Not PSD At Row 1. Too Many Equations for Data Set Size?
I hav learnt from the Handbook that the dependent varaible has to be included in the nonlin command. However it is not quite clear how to specify the last row. I also tried nlsystem(frml=strgl1,iters=1000,subiters=300,lwindow=neweywest) / x y gstart gend but got the output "## SX22. Expected Type FRML, Got SERIES Instead>>>>dow=neweywest) / x <<<<"
However, I have no idea how to solve this problem as i don`t know how to specify the last row. Any help will be appreciated. Thanks you!!!!!
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest) gstart gend
you never said what you want to estimate. It looks as if you want:
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest) gstart gend strgl1 strgl2
Are you sure about the use of the "mu" variables? Using mu1 in both locations in strgl1 doesn't look right.
Re: ESTR modelling in a non linear System
Thanks very much for your prompt and helpful response! The idea of the model is to determine whether the nominal exchange rate and relative prices adjust to changes in real exchange rates in the sense of error correction. Both equations (for prices and nominal exchange rates) are modelled with an Exponential Transision Function.
You were right, the mu1 was a mistake. The two equations are now
frml strgl1 y = mu0 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T))
frml strgl2 x = mu2 + alpha1*d(T-1)+ (mu3+alpha2*transfct2(T))
The output is now
Non-Linear System Estimation
Convergence in 1 Iterations. Final criterion was 0.0000000 <= 0.0000100
Monthly Data From 1973:01 To 2009:12
Usable Observations 437
Total Observations 444 Skipped/Missing 7
Function Value 874.00000000
Dependent Variable Y
Mean of Dependent Variable -0.200977434
Std Error of Dependent Variable 0.245817724
Standard Error of Estimate 0.245536307
Sum of Squared Residuals 26.345890055
Durbin-Watson Statistic 0.000686
Dependent Variable X
Mean of Dependent Variable -0.667888249
Std Error of Dependent Variable 0.375712401
Standard Error of Estimate 0.375282278
Sum of Squared Residuals 61.545676450
Durbin-Watson Statistic 0.005377
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.200977434 0.011745594 -17.11088 0.00000000
2. MU1 0.000000000 0.000000000 0.00000 0.00000000
3. ALPHA1 -7.933405431 0.213242215 -37.20373 0.00000000
4. ALPHA2 0.000000000 0.000000000 0.00000 0.00000000
5. GAMMA1 0.000000000 0.000000000 0.00000 0.00000000
6. MU2 0.000000000 0.000000000 0.00000 0.00000000
7. MU3 0.000000000 0.000000000 0.00000 0.00000000
8. ALPHA3 0.000000000 0.000000000 0.00000 0.00000000
9. ALPHA4 0.000000000 0.000000000 0.00000 0.00000000
10. GAMMA2 0.000000000 0.000000000 0.00000 0.00000000
11. LAMDA1 -0.667888249 0.000000000 0.00000 0.00000000
12. LAMDA2 0.000000000 0.000000000 0.00000 0.00000000
My suggestions were that in particular alpha2 and probably alpha4 should be significant, implying stronger adjustment when deviations from PPP are large. However, the model is obviously still misspecified as most parameters are zero and two are significant with very high t-values. Do you have any quick idea how to proceed? Lamda for the second equation is zero, so I would interpret this as evidence against nonlinearity....
I have never worked with Smooth Transistion models before so Iam not quite sure about a couple of things
- I have learnt that the starting value for lamda should not be set too high. However, I don`t know what starting values should be chosen for the other variables when running the Compute Procedure
-I also don`t know whats the best choice for the lag lenght in the transition function. Iincluded a lag of two below as an example
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest,lags=2) gstart gend strgl1 strgl2
Furthermore, the handbook says that the robust command should not be used in the context of nonlinearsystems so I left it out. Is that correct?
- I don`t know whether I should include lags for the dependent variables on the right side of the equation as this wouldn`t make much sense from a theoretical point of view. But this is a thing I just will have to try I guess
I don`t want to take too much of your time but I thought it would be easier to write down all my questions. You already helped me a lot with the code, thank you again!
You were right, the mu1 was a mistake. The two equations are now
frml strgl1 y = mu0 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T))
frml strgl2 x = mu2 + alpha1*d(T-1)+ (mu3+alpha2*transfct2(T))
The output is now
Non-Linear System Estimation
Convergence in 1 Iterations. Final criterion was 0.0000000 <= 0.0000100
Monthly Data From 1973:01 To 2009:12
Usable Observations 437
Total Observations 444 Skipped/Missing 7
Function Value 874.00000000
Dependent Variable Y
Mean of Dependent Variable -0.200977434
Std Error of Dependent Variable 0.245817724
Standard Error of Estimate 0.245536307
Sum of Squared Residuals 26.345890055
Durbin-Watson Statistic 0.000686
Dependent Variable X
Mean of Dependent Variable -0.667888249
Std Error of Dependent Variable 0.375712401
Standard Error of Estimate 0.375282278
Sum of Squared Residuals 61.545676450
Durbin-Watson Statistic 0.005377
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.200977434 0.011745594 -17.11088 0.00000000
2. MU1 0.000000000 0.000000000 0.00000 0.00000000
3. ALPHA1 -7.933405431 0.213242215 -37.20373 0.00000000
4. ALPHA2 0.000000000 0.000000000 0.00000 0.00000000
5. GAMMA1 0.000000000 0.000000000 0.00000 0.00000000
6. MU2 0.000000000 0.000000000 0.00000 0.00000000
7. MU3 0.000000000 0.000000000 0.00000 0.00000000
8. ALPHA3 0.000000000 0.000000000 0.00000 0.00000000
9. ALPHA4 0.000000000 0.000000000 0.00000 0.00000000
10. GAMMA2 0.000000000 0.000000000 0.00000 0.00000000
11. LAMDA1 -0.667888249 0.000000000 0.00000 0.00000000
12. LAMDA2 0.000000000 0.000000000 0.00000 0.00000000
My suggestions were that in particular alpha2 and probably alpha4 should be significant, implying stronger adjustment when deviations from PPP are large. However, the model is obviously still misspecified as most parameters are zero and two are significant with very high t-values. Do you have any quick idea how to proceed? Lamda for the second equation is zero, so I would interpret this as evidence against nonlinearity....
I have never worked with Smooth Transistion models before so Iam not quite sure about a couple of things
- I have learnt that the starting value for lamda should not be set too high. However, I don`t know what starting values should be chosen for the other variables when running the Compute Procedure
-I also don`t know whats the best choice for the lag lenght in the transition function. Iincluded a lag of two below as an example
nlsystem(parmset=P,iters=1000,subiters=300,lwindow=neweywest,lags=2) gstart gend strgl1 strgl2
Furthermore, the handbook says that the robust command should not be used in the context of nonlinearsystems so I left it out. Is that correct?
- I don`t know whether I should include lags for the dependent variables on the right side of the equation as this wouldn`t make much sense from a theoretical point of view. But this is a thing I just will have to try I guess
I don`t want to take too much of your time but I thought it would be easier to write down all my questions. You already helped me a lot with the code, thank you again!
Re: ESTR modelling in a non linear System
Your transition functions aren't really doing anything:
frml strgl1 y = mu0 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T))
The usual setup has the transition multiplying a term with the same form as the base, but with different coefficients. So you probably should have:
frml strgl1 y = mu0 + alpha3*d(T-1)+ transfct1(T)*(mu1+alpha4*d(T-1))
and similarly for the other. The lag in the transition function isn't governed by the LAGS option on NLSYSTEM. Because the transition delay is a discrete parameter, the only way to compare is to estimate the model with different delays and compare the results.
frml strgl1 y = mu0 + alpha3*d(T-1)+ (mu1+alpha4*transfct1(T))
The usual setup has the transition multiplying a term with the same form as the base, but with different coefficients. So you probably should have:
frml strgl1 y = mu0 + alpha3*d(T-1)+ transfct1(T)*(mu1+alpha4*d(T-1))
and similarly for the other. The lag in the transition function isn't governed by the LAGS option on NLSYSTEM. Because the transition delay is a discrete parameter, the only way to compare is to estimate the model with different delays and compare the results.
Re: ESTR modelling in a non linear System
Thanks again for your help with regard to the transition function. But what is the lag option doing usefull for in my code than. As I understand, I don`t refer to it so it can be deleted.
Anyway,The new modified code Iam running is now
compute lamda1 = %mean,gamma1=gamma2=1.0,lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 lamda2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z{1}-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z{1}-lamda2)^2)
frml strgl1 y = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*d(T-2))
frml strgl2 x = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*d(T-2))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha1=alpha2=alpha3=alpha4=1
nlsystem(parmset=P,iters=6000,subiters=3000,robust,lwindow=neweywest) gstart gend strgl1 strgl2
However, I have problems to make the system converge. For gamma I get really high coefficients. For one exchange rate I get the following output which is the best result of all estimations
Non-Linear System Estimation
Convergence in 35 Iterations. Final criterion was 0.0000053 <= 0.0000100
Robust Standard Error Calculations
Monthly Data From 1973:01 To 2009:12
Usable Observations 437
Total Observations 444 Skipped/Missing 7
Function Value 874.00000000
Dependent Variable X
Mean of Dependent Variable -0.002638458
Std Error of Dependent Variable 0.029385866
Standard Error of Estimate 0.027672900
Sum of Squared Residuals 0.3346499658
Durbin-Watson Statistic 1.972552
Dependent Variable Y
Mean of Dependent Variable -0.001469518
Std Error of Dependent Variable 0.006304093
Standard Error of Estimate 0.006059483
Sum of Squared Residuals 0.0160454748
Durbin-Watson Statistic 1.723985
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.03071921 0.00923657 -3 begin_of_the_skype_highlighting 0923657 -3 end_of_the_skype_highlighting.32582 0.00088158
2. MU1 -0.19717780 0.03458603 -5.70108 0.00000001
3. ALPHA1 0.28084180 0.04285907 6.55268 0.00000000
4. ALPHA2 -0.29879737 0.04301065 -6.94706 0.00000000
5. GAMMA1 11.79173398 9.16135106 1.28712 0.19805339
6. MU2 0.00266724 0.00098079 2.71949 0.00653833
7. MU3 -0.01674251 0.00770042 -2.17423 0.02968762
8. ALPHA3 0.02385827 0.01031797 2.31230 0.02076097
9. ALPHA4 -0.01439470 0.00995114 -1.44654 0.14802662
10. GAMMA2 18.68988483 11.26778642 1.65870 0.09717613
11. LAMDA1 0.00980024 0.00058311 16.80678 0.00000000
12. LAMDA2 0.00209556 0.00024524 8.54500 0.00000000
I was just wondering how to interpret the large values of gamma . In addition, Iam not sure about the chocice of the other starting values. I was also wondering whether non convergence of the overall system can mainly be a result of one equation.......Thanks again for help
Anyway,The new modified code Iam running is now
compute lamda1 = %mean,gamma1=gamma2=1.0,lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 lamda2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z{1}-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z{1}-lamda2)^2)
frml strgl1 y = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*d(T-2))
frml strgl2 x = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*d(T-2))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha1=alpha2=alpha3=alpha4=1
nlsystem(parmset=P,iters=6000,subiters=3000,robust,lwindow=neweywest) gstart gend strgl1 strgl2
However, I have problems to make the system converge. For gamma I get really high coefficients. For one exchange rate I get the following output which is the best result of all estimations
Non-Linear System Estimation
Convergence in 35 Iterations. Final criterion was 0.0000053 <= 0.0000100
Robust Standard Error Calculations
Monthly Data From 1973:01 To 2009:12
Usable Observations 437
Total Observations 444 Skipped/Missing 7
Function Value 874.00000000
Dependent Variable X
Mean of Dependent Variable -0.002638458
Std Error of Dependent Variable 0.029385866
Standard Error of Estimate 0.027672900
Sum of Squared Residuals 0.3346499658
Durbin-Watson Statistic 1.972552
Dependent Variable Y
Mean of Dependent Variable -0.001469518
Std Error of Dependent Variable 0.006304093
Standard Error of Estimate 0.006059483
Sum of Squared Residuals 0.0160454748
Durbin-Watson Statistic 1.723985
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.03071921 0.00923657 -3 begin_of_the_skype_highlighting 0923657 -3 end_of_the_skype_highlighting.32582 0.00088158
2. MU1 -0.19717780 0.03458603 -5.70108 0.00000001
3. ALPHA1 0.28084180 0.04285907 6.55268 0.00000000
4. ALPHA2 -0.29879737 0.04301065 -6.94706 0.00000000
5. GAMMA1 11.79173398 9.16135106 1.28712 0.19805339
6. MU2 0.00266724 0.00098079 2.71949 0.00653833
7. MU3 -0.01674251 0.00770042 -2.17423 0.02968762
8. ALPHA3 0.02385827 0.01031797 2.31230 0.02076097
9. ALPHA4 -0.01439470 0.00995114 -1.44654 0.14802662
10. GAMMA2 18.68988483 11.26778642 1.65870 0.09717613
11. LAMDA1 0.00980024 0.00058311 16.80678 0.00000000
12. LAMDA2 0.00209556 0.00024524 8.54500 0.00000000
I was just wondering how to interpret the large values of gamma . In addition, Iam not sure about the chocice of the other starting values. I was also wondering whether non convergence of the overall system can mainly be a result of one equation.......Thanks again for help
Re: ESTR modelling in a non linear System
You cut off the code at the top, so it's not clear what the %variance is that's being used to compute scalef. You want that to be the variance of Z. If it's not, and it's the variance of something else, then the gamma's are much harder to interpret. If you defined %variance correctly, then such a high value of gamma means that the transition applies basically to just one value, that is, it's found a (large) outlier rather than a smooth transition. That may be due to faulty guess values, or it may be that there just isn't a transition to be found. Have you tried doing one equation at a time?
The lags option on the NLSYSTEM is being used for HAC covariance matrix calculations.
The lags option on the NLSYSTEM is being used for HAC covariance matrix calculations.
Re: ESTR modelling in a non linear System
Thanks for your explanations on the transition function. I haven`t tried one equation at a time yet but I will do that!
I just put compute scalef=1.0/sqrt(%variance)
in the code as I found this standardization in the code which was posted as an example here thinking that this formular was correct. What changes are needed to make it depend on the variance of z? Do I have to use a linreg command before? Sorry for this silly question but I have mainly applied Cats up to this date. Thanks for your help!
I just put compute scalef=1.0/sqrt(%variance)
in the code as I found this standardization in the code which was posted as an example here thinking that this formular was correct. What changes are needed to make it depend on the variance of z? Do I have to use a linreg command before? Sorry for this silly question but I have mainly applied Cats up to this date. Thanks for your help!
Re: ESTR modelling in a non linear System
add
statistics z
before the compute scalef=...
statistics z
before the compute scalef=...
Re: ESTR modelling in a non linear System
Thanks for your help. I modified the code again but still get mostly insignificant result when estimating in a system. If convergence is achieved, I Mostly get either high coefficients (see below)
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 0.1260162 0.0053683 23.47413 0.00000000
2. MU1 -0.1350563 0.0000000 0.00000 0.00000000
3. ALPHA1 -36.6904033 0.0081004 -4529.44772 0.00000000
4. ALPHA2 36.6793023 0.0000000 0.00000 0.00000000
5. GAMMA1 844.1382636 0.0000000 0.00000 0.00000000
6. MU2 -0.0038892 0.0010004 -3.88750 0.00010128
7. MU3 0.0026111 0.0013593 1.92092 0.05474234
8. ALPHA3 0.0872920 0.0320976 2.71958 0.00653650
9. ALPHA4 -0.0865629 0.0317795 -2.72386 0.00645247
10. GAMMA2 8.8318123 3.8950143 2.26747 0.02336178
11. LAMDA1 1.1121018 0.0000000 0.00000 0.00000000
12. LAMDA2 0.2850365 0.0128626 22.16003 0.00000000
Or I get no significant coefficients like below
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.000622261 0.001948554 -0.31934 0.74946498
2. MU1 0.004266045 0 begin_of_the_skype_highlighting 04266045 0 end_of_the_skype_highlighting.005130679 0.83148 0.40570383
3. ALPHA1 -0.002758907 0.036440406 -0.07571 0.93964973
4. ALPHA2 -0.021394132 0.040857120 -0.52363 0.60053391
5. GAMMA1 0.710182883 1.779614867 0.39907 0.68984495
6. MU2 0.000547741 0.000552490 0.99141 0.32148759
7. MU3 0.001187868 0.000903034 1.31542 0.18836899
8. ALPHA3 0.011834741 0.013075626 0.90510 0.36541274
9. ALPHA4 -0.006634024 0.013892319 -0.47753 0.63298351
10. GAMMA2 1.388421973 2.565642661 0.54116 0.58839763
Estimating one equation, I often get significant gammas and delta but no significant parameters, for example
ependent Variable X
Mean of Dependent Variable -0.002656606
Std Error of Dependent Variable 0.027814580
Standard Error of Estimate 0.027667192
Sum of Squared Residuals 0.3352773969
Durbin-Watson Statistic 1.337705
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.004033908 0.008020912 -0.50292 0.61501785
2. MU1 0.003101687 0.008535580 0.36338 0.71631863
3. ALPHA1 -0.037904353 0.058074931 -0.65268 0.51396252
4. ALPHA2 0.029765376 0.061979186 0.48025 0.63105111
5. GAMMA1 1.753109631 4.550787938 0.38523 0.70006546
6. LAMDA1 4.657112555 0.233523485 19.94280 0.00000000
Now, the first remaining question is how I might interpret lamda if I don`t use the real exchange rate as the transistion variable ( in which case it is the mean of the real exchange rate).
Iam now trying different transition variables, for example the absolute average of the real exchange rate during the last 3 or 6 months. As I understand, lamda in this case is just the mean of all 3 or 6 months average over the sample.
However, as this is not clear to interpret I also excluded Lamda from the non-linear Parameterset writing just
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2
and defining lamda as the mean of the real exchange rate. I think this would theoretically make sense as large (small) values of the transition variable (z) relative to the threshold (lamda) now refer to large (small) deviations from the average real exchange rate. My second question therefore is whether it makes sense to exclude lamda in the way I did because this restricts the set of allowable threshold values to basically one value which might lead to the fact that one of the two regimes don`t have enough observations for the estimation. However, if I get significant results I would interpret this in a positive way as the chosen threshold seems to be adequate. Thanks again for your help
Altogether, my results are quite puzzling considering the fact that there is rich evidence of non linearity in the context of exchange rate
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 0.1260162 0.0053683 23.47413 0.00000000
2. MU1 -0.1350563 0.0000000 0.00000 0.00000000
3. ALPHA1 -36.6904033 0.0081004 -4529.44772 0.00000000
4. ALPHA2 36.6793023 0.0000000 0.00000 0.00000000
5. GAMMA1 844.1382636 0.0000000 0.00000 0.00000000
6. MU2 -0.0038892 0.0010004 -3.88750 0.00010128
7. MU3 0.0026111 0.0013593 1.92092 0.05474234
8. ALPHA3 0.0872920 0.0320976 2.71958 0.00653650
9. ALPHA4 -0.0865629 0.0317795 -2.72386 0.00645247
10. GAMMA2 8.8318123 3.8950143 2.26747 0.02336178
11. LAMDA1 1.1121018 0.0000000 0.00000 0.00000000
12. LAMDA2 0.2850365 0.0128626 22.16003 0.00000000
Or I get no significant coefficients like below
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.000622261 0.001948554 -0.31934 0.74946498
2. MU1 0.004266045 0 begin_of_the_skype_highlighting 04266045 0 end_of_the_skype_highlighting.005130679 0.83148 0.40570383
3. ALPHA1 -0.002758907 0.036440406 -0.07571 0.93964973
4. ALPHA2 -0.021394132 0.040857120 -0.52363 0.60053391
5. GAMMA1 0.710182883 1.779614867 0.39907 0.68984495
6. MU2 0.000547741 0.000552490 0.99141 0.32148759
7. MU3 0.001187868 0.000903034 1.31542 0.18836899
8. ALPHA3 0.011834741 0.013075626 0.90510 0.36541274
9. ALPHA4 -0.006634024 0.013892319 -0.47753 0.63298351
10. GAMMA2 1.388421973 2.565642661 0.54116 0.58839763
Estimating one equation, I often get significant gammas and delta but no significant parameters, for example
ependent Variable X
Mean of Dependent Variable -0.002656606
Std Error of Dependent Variable 0.027814580
Standard Error of Estimate 0.027667192
Sum of Squared Residuals 0.3352773969
Durbin-Watson Statistic 1.337705
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. MU0 -0.004033908 0.008020912 -0.50292 0.61501785
2. MU1 0.003101687 0.008535580 0.36338 0.71631863
3. ALPHA1 -0.037904353 0.058074931 -0.65268 0.51396252
4. ALPHA2 0.029765376 0.061979186 0.48025 0.63105111
5. GAMMA1 1.753109631 4.550787938 0.38523 0.70006546
6. LAMDA1 4.657112555 0.233523485 19.94280 0.00000000
Now, the first remaining question is how I might interpret lamda if I don`t use the real exchange rate as the transistion variable ( in which case it is the mean of the real exchange rate).
Iam now trying different transition variables, for example the absolute average of the real exchange rate during the last 3 or 6 months. As I understand, lamda in this case is just the mean of all 3 or 6 months average over the sample.
However, as this is not clear to interpret I also excluded Lamda from the non-linear Parameterset writing just
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2
and defining lamda as the mean of the real exchange rate. I think this would theoretically make sense as large (small) values of the transition variable (z) relative to the threshold (lamda) now refer to large (small) deviations from the average real exchange rate. My second question therefore is whether it makes sense to exclude lamda in the way I did because this restricts the set of allowable threshold values to basically one value which might lead to the fact that one of the two regimes don`t have enough observations for the estimation. However, if I get significant results I would interpret this in a positive way as the chosen threshold seems to be adequate. Thanks again for your help
Altogether, my results are quite puzzling considering the fact that there is rich evidence of non linearity in the context of exchange rate
Re: ESTR modelling in a non linear System
This can't be right:
frml strgl1 y = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*d(T-2))
frml strgl2 x = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*d(T-2))
Your base model would seem to have been mu+alpha*d(t-1). You need four "copies" of that, with different "labels", combined using the transition function. To be consistent in your labelling, I would suggest:
frml strgl1 y = mu0+alpha0*d(t-1)+transfct1(T)*(mu1+alpha1*d(T-1))
frml strgl2 x = mu2+alpha2*d(t-1)+transfct2(T)*(mu3+alpha3*d(T-1))
so your parameters are mu0, mu1, mu2, mu3, alpha0, alpha1, alpha2, alpha3 and the gamma's and lambda's for the transition functions. This will give you (for the y equation) y = mu0+alpha0*d(t-1) when the transition function is zero, y = mu0+mu1+(alpha0+alpha1)*d(t-1) when the transition function is one, and a linear combination of the two for values in between.
frml strgl1 y = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*d(T-2))
frml strgl2 x = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*d(T-2))
Your base model would seem to have been mu+alpha*d(t-1). You need four "copies" of that, with different "labels", combined using the transition function. To be consistent in your labelling, I would suggest:
frml strgl1 y = mu0+alpha0*d(t-1)+transfct1(T)*(mu1+alpha1*d(T-1))
frml strgl2 x = mu2+alpha2*d(t-1)+transfct2(T)*(mu3+alpha3*d(T-1))
so your parameters are mu0, mu1, mu2, mu3, alpha0, alpha1, alpha2, alpha3 and the gamma's and lambda's for the transition functions. This will give you (for the y equation) y = mu0+alpha0*d(t-1) when the transition function is zero, y = mu0+mu1+(alpha0+alpha1)*d(t-1) when the transition function is one, and a linear combination of the two for values in between.
Re: ESTR modelling in a non linear System
I already have corrected this mistake, I just didn`t want to post the new code all the time. Sorry for that! My last post refers to
statistics z
compute lamda1 = %mean,gamma1=2.0, gamma2=2.0,lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 lamda2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-1)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-1)-lamda2)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda2))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha1=alpha2=1, alpha3=alpha4=1
nlsystem(parmset=P,iters=6000,subiters=3000,lwindow=neweywest,lags=2) gstart gend strgl1 strgl2
So I still have the difficulties described. Iam really sorry for not posting the new code earlier!
statistics z
compute lamda1 = %mean,gamma1=2.0, gamma2=2.0,lamda2 = %mean
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 lamda2
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-1)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-1)-lamda2)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda2))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha1=alpha2=1, alpha3=alpha4=1
nlsystem(parmset=P,iters=6000,subiters=3000,lwindow=neweywest,lags=2) gstart gend strgl1 strgl2
So I still have the difficulties described. Iam really sorry for not posting the new code earlier!
Re: ESTR modelling in a non linear System
That looks correct. And the single equation estimates look perfectly reasonable; they may not be what you want to see, but they don't look wrong. If you're getting results that are different from the literature, what are you doing that's different? Is there evidence of ESTAR with monthly data, like you're using, or is it just at higher frequencies?
Re: ESTR modelling in a non linear System
I guess I have to modify my post as it was confusing before
I have modified the model in the sense that the Transition function now depends on the second lag (see below) and the results have improved in terms of significance and convergation and are now also in line with other results in the literature
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-2)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-2)-lamda2)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda2))
Now, Teraesvirta suggests testing linarity against an ESTAR model and the procedure is also adequate to detect the correct lag of the transition function. The idea is based on a third order Taylor approximation. I programmed it myself and applied the test using the test command. Does the squi value which Rats gives refers to an LM Test in this case? I could not use exclude since Iam modelling two equations jointly. As the last step of my analysis I want to test for Serial Correlation using LM Tests. Is there a code for this step as Iam not quite sure how to do it?
I have modified the model in the sense that the Transition function now depends on the second lag (see below) and the results have improved in terms of significance and convergation and are now also in line with other results in the literature
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-2)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-2)-lamda2)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda2)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda2))
Now, Teraesvirta suggests testing linarity against an ESTAR model and the procedure is also adequate to detect the correct lag of the transition function. The idea is based on a third order Taylor approximation. I programmed it myself and applied the test using the test command. Does the squi value which Rats gives refers to an LM Test in this case? I could not use exclude since Iam modelling two equations jointly. As the last step of my analysis I want to test for Serial Correlation using LM Tests. Is there a code for this step as Iam not quite sure how to do it?
Re: ESTR modelling in a non linear System
The test for linearity that you're describing is included in the STARTEST procedure. That has a general test for non-linearity and nests tests for both LSTAR and ESTAR.
Re: ESTR modelling in a non linear System
Hi,
I managed to programm the test for linearity by myself (It was sightly different as I use a NL-system estimator). However, Iam still really struggling with the autocorrelation test.
The proccedure is based on the test of autocorrelation developed by Breusch and Pagan. The idea is to regress the residuals on the lagged residuals of the original model and on the partial derivatives of the parameter namely the threshold, the gamma and the other coefficients. Now, the beginning in case of autocorrelation of order one obviously would be
linreg resids
# constant resids(t-1)
But Iam not quite sure how to calculate the partial derivatives which also have to be included on the right hand side of the equation. I was wondering whether I can use the command "derives" or "deriv". Is it possible to use the following command to acheive the derivatives (here for alpha 1 and alpha 2) when estimating the system?
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 derivalpha1 derivalpha2
Or should I use the command after the System is estimated and if so how? If I could acheive the estmimates in this way it would be easy to include them in the linreg command above. I would be really gratefull for help as this kind of test is the last step in my analysis.Thanks!!!
By the way, my overall Code for the system is
statistics z
compute lamda1 = %mean,gamma1=5.2,gamma2=0.005
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-2)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-2)-lamda1)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda1)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda1))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha2=-0.5, alpha1=0.5, alpha3=-0.5,alpha4=+0.54
nlsystem(parmset=P,iters=2000,subiters=3000,robust,lwindow=neweywest,lags=1) gstart gend strgl1 strgl2
I managed to programm the test for linearity by myself (It was sightly different as I use a NL-system estimator). However, Iam still really struggling with the autocorrelation test.
The proccedure is based on the test of autocorrelation developed by Breusch and Pagan. The idea is to regress the residuals on the lagged residuals of the original model and on the partial derivatives of the parameter namely the threshold, the gamma and the other coefficients. Now, the beginning in case of autocorrelation of order one obviously would be
linreg resids
# constant resids(t-1)
But Iam not quite sure how to calculate the partial derivatives which also have to be included on the right hand side of the equation. I was wondering whether I can use the command "derives" or "deriv". Is it possible to use the following command to acheive the derivatives (here for alpha 1 and alpha 2) when estimating the system?
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1 derivalpha1 derivalpha2
Or should I use the command after the System is estimated and if so how? If I could acheive the estmimates in this way it would be easy to include them in the linreg command above. I would be really gratefull for help as this kind of test is the last step in my analysis.Thanks!!!
By the way, my overall Code for the system is
statistics z
compute lamda1 = %mean,gamma1=5.2,gamma2=0.005
compute scalef=1.0/sqrt(%variance)
nonlin(parmset=P) mu0 mu1 alpha1 alpha2 gamma1 mu2 mu3 alpha3 alpha4 gamma2 lamda1
frml transfct1 = 1-exp(-scalef^2*gamma1*(z(T-2)-lamda1)^2)
frml transfct2 = 1-exp(-scalef^2*gamma2*(z(T-2)-lamda1)^2)
frml strgl1 x = mu0 + alpha1*(z(T-1)-lamda1)+ transfct1(T)*(mu1+alpha2*(z(T-1)-lamda1))
frml strgl2 y = mu2 + alpha3*(z(T-1)-lamda1)+ transfct2(T)*(mu3+alpha4*(z(T-1)-lamda1))
compute mu0=0,mu1=0,mu2=0, mu3=0, alpha2=-0.5, alpha1=0.5, alpha3=-0.5,alpha4=+0.54
nlsystem(parmset=P,iters=2000,subiters=3000,robust,lwindow=neweywest,lags=1) gstart gend strgl1 strgl2