Filardo_msvartvpemestima, missing value

Discussion of models with structural breaks or endogenous switching.
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Filardo_msvartvpemestima, missing value

Unread post by vtsa »

Dear Tom,
When I run the Filardo (1994) code with my data, I got the following message:
*
equation p1eq *
# constant oil_net{1}
equation p2eq *
# constant oil_net{1}
*
compute v1=log(.5/.3)~~0.0
compute v2=log(.95/.05)~~0.0
compute mu(1)=-0.05,mu(2)=.006
@MSVARTVPEMEstimate(cvcrit=.0001) gstart gend
*
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
The Error Occurred At Location 949, Line 41 of MSVARTVPEMESTIMA

There is no missing value in the oil_net data, but it has zeros and some positive values. However, when I do the following change, I got the same message:
*
sample(smpl=%valid(oil_net)) oil_net / oilnet
calendar(irregular)
compute gstart=1,gend=%nobs
*
* Define the logistic index for the transitions
*
equation p1eq *
# constant oil_net{1}
equation p2eq *
# constant oil_net{1}
*
*
compute v1=log(.5/.3)~~0.0
compute v2=log(.95/.05)~~0.0
compute mu(1)=-0.05,mu(2)=.006
@MSVARTVPEMEstimate(cvcrit=.0001) gstart gend
*
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
The Error Occurred At Location 949, Line 41 of MSVARTVPEMESTIMA

Could you please help me to solve this problem?

I appreciate You very much for your help!
vasif
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Filardo_msvartvpemestima, missing value

Unread post by TomDoan »

That may (and probably does) have nothing to do with the transition. You could have a problem with the overall range of the MS estimation. Have you successfully estimated the same model with fixed transition probabilities?
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Re: Filardo_msvartvpemestima, missing value

Unread post by vtsa »

Dear Tom,
When I estimated the model with the MSRegression option (which is shown below) , I got the following absurd result:
*

Code: Select all

@MSRegression(switch=c,nfix=2,states=2) gip
# constant gip{1 2} oil_net{1 2}
*
nonlin(parmset=regparms) betas gammas sigsq
nonlin(parmset=msparms)  p
*
MAXIMIZE - Estimation by BFGS
Convergence in    15 Iterations. Final criterion was  0.0000041 <=  0.0000100
Monthly Data From 1986:05 To 2014:09
Usable Observations                       341
Function Value                       601.4103

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  BETAS(1)(1)                  -0.269164274  0.101183049     -2.66017  0.00781008
2.  BETAS(1)(2)                   0.212097718  0.131018909      1.61883  0.10548323
3.  BETAS(1)(3)                   0.056780364  0.127282691      0.44610  0.65552754
4.  BETAS(2)(1)                  -0.119412812  0.086367741     -1.38261  0.16678480
5.  BETAS(2)(2)                  -0.187672498  0.086068541     -2.18050  0.02922038
6.  BETAS(2)(3)                  -0.023092730  0.074578201     -0.30964  0.75683130
7.  GAMMAS(1)                     0.007140545  0.002331930      3.06207  0.00219809
8.  GAMMAS(2)                    -0.692517267  0.054594860    -12.68466  0.00000000
9.  SIGSQ                         0.001675879  0.000131322     12.76162  0.00000000
10. P(1,1)                        0.932616990  0.086117193     10.82963  0.00000000
11. P(1,2)                        0.054442146  0.075560269      0.72051  0.47120928

Conditional Mean for Regime 1      -0.36815
Conditional Mean for Regime 2      -0.09863
This result is not satisfying. The conditional means both are negative and P(1,2) is insignificant.
Further, I estimated it with MSVAR option (which is shown below) and I got the following result with no convergence:

Code: Select all

*
*
@msvarsetup(lags=2,switch=m)
# gip oil_net
nonlin(parmset=msparms) p
nonlin(parmset=varparms) mu phi sigma
*
MAXIMIZE - Estimation by BFGS
NO CONVERGENCE IN 13 ITERATIONS
LAST CRITERION WAS  0.0000000
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Monthly Data From 1986:05 To 2014:09
Usable Observations                       341
Function Value                        NA

    Variable                        Coeff      Std Error      T-Stat       Signif
*************************************************************************************
1.  MU(1)(1)                         0.002697   328.997335  8.19657e-006  0.99999346
2.  MU(1)(2)                        -0.101547  4369.504653 -2.32399e-005  0.99998146
3.  MU(2)(1)                         0.003668     0.001139       3.21906  0.00128612
4.  MU(2)(2)                         0.011318     0.002412       4.69278  0.00000270
5.  PHI(1)(1,1)                     -0.675947     0.035885     -18.83668  0.00000000
6.  PHI(1)(2,1)                     -0.114823     0.032018      -3.58624  0.00033548
7.  PHI(1)(1,2)                     -0.061099     0.034179      -1.78762  0.07383761
8.  PHI(1)(2,2)                      0.246516     0.019488      12.64997  0.00000000
9.  PHI(2)(1,1)                     -0.179852     0.040657      -4.42369  0.00000970
10. PHI(2)(2,1)                     -0.048140     0.029950      -1.60736  0.10797612
11. PHI(2)(1,2)                      0.011046     0.041982       0.26312  0.79245564
12. PHI(2)(2,2)                     -0.004283     0.059396      -0.07211  0.94251275
13. SIGMA(1,1)                       0.001759     0.000105      16.75340  0.00000000
14. SIGMA(2,1)                       0.000001     0.000076       0.00683  0.99454680
15. SIGMA(2,2)                       0.001319     0.000123      10.76753  0.00000000
16. P(1,1)                           0.851520 33738.732131  2.52387e-005  0.99997986
17. P(1,2)                          -0.000010     0.000036      -0.27586  0.78265851

AIC =       NA SIC =       NA LogL =       NA
Does that mean that the problem is in the oil_net data? I try to replicate Reymond and Rich(1997)'s "Oil and The Macroeconomy:A Markov Swithcing Approach" which uses net real oil price increase (oil_net) as a leading indicator of the GDP.
I appreciate you very much for your help.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Filardo_msvartvpemestima, missing value

Unread post by TomDoan »

vasifabiyev wrote:Dear Tom,
When I estimated the model with the MSRegression option (which is shown below) , I got the following absurd result:
*
@MSRegression(switch=c,nfix=2,states=2) gip
# constant gip{1 2} oil_net{1 2}
*
nonlin(parmset=regparms) betas gammas sigsq
nonlin(parmset=msparms) p
1. Why would you do NFIX=2? That fixes the intercept and the gip{1} across the two regimes. I can't imagine that's what you want.

2. How do you compute the conditional means? This isn't a self-contained process, so there is no way to compute the conditional mean based upon one equation in isolation.
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Re: Filardo_msvartvpemestima, missing value

Unread post by vtsa »

Dear Tom Doan,
I just meant to make the oil_net variable to be independent of the unobserved state, but I understand that I'm wrong. Calculation of conditional means also wrong. Conditional means are estimated by using MSVARsetup. And the problem is sourced from the oil_net data, isn't it.
Dear Tom,
I’m trying to estimate the following model.
[y(t)-μ(s)(t)] = ∑α(i)[y(t-i) - μ(s)(t-i)] + ∑β[oil(t-i)]
In that model the oil variable is assumed to be independent of the unobserved state variable (St).
I estimated it by using MSVARsetup and got the following result.

Code: Select all

*
@msvarsetup(lags=2,switch=m)
# gip oil
nonlin(parmset=msparms) p
nonlin(parmset=varparms) mu phi sigma
*
MAXIMIZE - Estimation by BFGS
Convergence in    27 Iterations. Final criterion was  0.0000037 <=  0.0000100
Monthly Data From 1986:05 To 2014:09
Usable Observations                       341
Function Value                       952.4569

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  MU(1)(1)                     -0.029939675  0.007697336     -3.88962  0.00010040
2.  MU(1)(2)                     -0.209409850  0.029040433     -7.21098  0.00000000
3.  MU(2)(1)                      0.005133601  0.001239563      4.14146  0.00003451
4.  MU(2)(2)                      0.011578332  0.005323196      2.17507  0.02962474
5.  PHI(1)(1,1)                  -0.724461603  0.043088783    -16.81323  0.00000000
6.  PHI(1)(2,1)                  -0.108610053  0.109616466     -0.99082  0.32177408
7.  PHI(1)(1,2)                  -0.028157007  0.025979778     -1.08380  0.27845137
8.  PHI(1)(2,2)                   0.225297042  0.056265852      4.00415  0.00006224
9.  PHI(2)(1,1)                  -0.220512666  0.045502149     -4.84620  0.00000126
10. PHI(2)(2,1)                  -0.025448829  0.110172017     -0.23099  0.81732120
11. PHI(2)(1,2)                   0.029158569  0.027153989      1.07382  0.28290216
12. PHI(2)(2,2)                  -0.079548526  0.059973685     -1.32639  0.18471038
13. SIGMA(1,1)                    0.001629466  0.000102651     15.87382  0.00000000
14. SIGMA(2,1)                    0.000044226  0.000184693      0.23946  0.81075121
15. SIGMA(2,2)                    0.006491502  0.000536201     12.10648  0.00000000
16. P(1,1)                        0.530962384  0.128476636      4.13275  0.00003584
17. P(1,2)                        0.020376396  0.008905340      2.28811  0.02213112
But MSVARsetup also takes the oil variable as an endogenous variable. Should I take the coefficients of the above mentioned equation for interpretation and ignore the coefficients of the second oil equation? Am I right or how should I do?
I appreciate You very much for your help. I look forward to hearing from You.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Filardo_msvartvpemestima, missing value

Unread post by TomDoan »

vasifabiyev wrote:Dear Tom Doan,
I just meant to make the oil_net variable to be independent of the unobserved state, but I understand that I'm wrong. Calculation of conditional means also wrong. Conditional means are estimated by using MSVARsetup. And the problem is sourced from the oil_net data, isn't it.
Dear Tom,
I’m trying to estimate the following model.
[y(t)-μ(s)(t)] = ∑α(i)[y(t-i) - μ(s)(t-i)] + ∑β[oil(t-i)]
In that model the oil variable is assumed to be independent of the unobserved state variable (St).
That model can't be estimated directly by any of the higher end procedures because you're adding the exogenous variable to the MS-autoregression. However, I'm not sure it's a good form. Precisely because of the exogenous variable, the "Hamilton" style mean switching isn't appropriate, since the mean of the process is time-varying with the exogenous variables. It would make more sense to have a model with the constant switching rather than the mean. You can set that up with

@MSRegression(switch=c,nfix=4,states=2) gip
# gip{1 2} oil_net{1 2} constant

Note that you list the fixed parameters first---in your previous attempt, you had the fixed parameters listed last.
vtsa
Posts: 19
Joined: Thu Oct 10, 2013 7:25 am

Re: Filardo_msregtvpemestima

Unread post by vtsa »

Dear Tom,
I estimated a TVTP-MS model with non-switching variance by using @MSregression option:

Code: Select all

*
@MSRegression(switch=c,nfix=4,states=2) gip
# oilrd{1 to 2} gip{1 to 2} constant
*
compute gstart=1986:2,gend=2014:9
@MSRegInitial gstart gend
*
@MSFilterSetup(em)
*
nonlin(parmset=common) betas gammas sigsq
dec equation p1eq   p2eq
dec vector   v1     v2
dec vector   p1mean p2mean
nonlin(parmset=tv) v1 v2
*
I got the following results:

Code: Select all

MAXIMIZE - Estimation by BHHH
Convergence in    37 Iterations. Final criterion was  0.0000069<=  0.0000100
Monthly Data From 1986:02 To 2014:09
Usable Observations                       344
Function Value                       622.1343

    Variable                        CoeffStd Error      T-Stat      Signif
************************************************************************************
1.  V1(1)                         -3.29514816   4.08188937     -0.80726  0.41951640
2.  V1(2)                         31.11261285  41.79693227      0.74438  0.45664933
3.  V2(1)                          3.20327196   0.43964593      7.28603  0.00000000
4.  V2(2)                          3.37291935   4.26251194      0.79130  0.42876982
5.  BETAS(1)(1)                   -0.08888280   0.00998915     -8.89794  0.00000000
6.  BETAS(2)(1)                    0.01270169   0.00221624      5.73119  0.00000001
7.  GAMMAS(1)                      0.01929429   0.01894784      1.01828  0.30854278
8.  GAMMAS(2)                      0.04108859   0.02264377      1.81457  0.06959075
9.  GAMMAS(3)                     -0.73948948   0.04217017    -17.53584  0.00000000
10. GAMMAS(4)                     -0.23550132   0.05550672     -4.24275  0.00002208
11. SIGSQ                          0.00124526   0.00000000      0.00000  0.00000000
The standard error and the t-statistic of sigsq are both zero. How to solve this problem?
I appreciate You for your help!
( Note: MSregression code is obtainded from https://estima.com/forum/viewtopic.php? ... t=30#p5340)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Filardo_msvartvpemestima, missing value

Unread post by TomDoan »

What you're copying has regime-switching variances, so you'll have to switch the calculation to use the fixed variance instead.
Post Reply