楼主: liying0782
13099 26

[问答] 求助:关于MSVAR程序包 [推广有奖]

11
ferguson06 发表于 2012-4-15 19:12:37
epoh 发表于 2012-4-11 18:45
/*请自行先把数据处理好*/
month year   x    y
1    1960  123  321
epoh老师,我上面的改动有什么错误吗?其中有几个改动我按照你的改的,但是我有几个问题想请教您。1、_n_x=1;  和  _n_z=1;这两个为什么选1呢?2、我的数据是原始数据,没有进行过任何差分和导数变化,所以F_option,k_lag和d_option 三个都选0?3、我结果出来以后,想做个脉冲响应函数,这应该如何实现。4、我运行我自己的数据时,滤波概率图和平滑概率图的横坐标貌似都显示的是月份,我修改了MSVAR.prg 下面的fitted其中的一项,把mouth改为year,但好像不起作用。。   

12
ferguson06 发表于 2012-4-15 20:31:01
epoh 发表于 2012-4-11 18:45
/*请自行先把数据处理好*/
month year   x    y
1    1960  123  321
我用了修改后的程序跑我的数据,但出来的结果第一行就是===========================MS OLS and MSVAR Analysis  with MSVARlib - Copyright (C) 2004 by Benoit BELLONE ==================================
Data File MSVARUN

Date:  4/15/12   Initial time: 20:26:43

Start and ending period
     86.00000000    530.00000000

Options
_K,      1.00000000,  _M,      2.00000000,  _M_V,      2.00000000,  _Var_opt,      2.00000000,  _typmod,      1.00000000,  _p,       1.00000000
而我的程序明明已经改成了
/*===============================================Choosing your model ======================================================*/

_K=2;
_M=2;
_M_V=_M;  /*  _M_V=1 : no switch in variance  or _MV_=_M : switch in variance  */
_Var_opt=1;
_typmod=3;
_p=1;          /*  degree of the MSVAR(p)  for p>=1 if under construction */

_n_x=1;        /* number of exogenous, switching variables (including intercept) _n_x=1 by default for the model 1 */
_n_z=1;        /* number of exogenous, non-switching variables (including intercept) _n_z=1 by default for the model 1 */

/*========================================================================================================*/
/* k_lag  degree of transformation of data : 100.(F(x(t))-F(x(t-k_lag)))                                  */
/* F_option : transformation mode =(0,1,2) : 0  id, 1 dlog(.), 2 d(.)        (notice that if k==0 f_option is set to 0)*/
/* d_option : second transformation of data =(0,1,2) : 0  id, 1 demeaned series (x-E(X)), 2 standardized series (X-D(X)./Sigma(X)*/     
/*=======================================================================================================*/

F_option=0;
k_lag=0;
d_option=0;


/* ==========Start and ending index : some  common available values for US events  (see readme for templates of dates) =========== */
deb=1;
fin=26;
/*
Some date : 1960-1 : 1, 1964-1 :49, 1967-2 :86, 1979-1 : 229 ,1984-1 : 289, 1985-1 : 301 1989-1: 349,  1989-12: 360,   1995-1 : 421, 1999-12 : 480,  2000-12 : 492,  
Last available date : 2003-1 517
Estimating Date :     1985-1 : 301 , 1989-1: 349 , 1999-12 : 480, 2000-12 :492, 2003-1 : 517, 2004-2: 529
Starting Date :         1967-2 :86, 1979-1 : 229
*/

/*========== =======================================Datation reference options ========================================*/
/*     if _apriori==0, no reference datation is needed, else you need to provide an apriori datation, si ref_date.xls for an example                         */
/*     date_col may be optional (put in @ @) if you want to skip it                                                                                                                                 */
/*========== =====================================================================================================*/
_apriori=0;
date_col=3;   /*  column number of the selected datation, for MSVARrec4 "Recessions NBER" (date_col=7),  "3_state Anas" (date_col=8) */

/*==============================================================*/
/* ESTIMATION or FILTERING with initial parameters ?                                              */
/* Estim : 1 if estimation, 0 if filtering                                                                        */
/* if estim = 0, a parameter matrix should be imported                                              */
/*==============================================================*/

estim=1;

/*====================================Choosing your model  - end  of section===============================================

13
ferguson06 发表于 2012-4-15 20:35:00
epoh 发表于 2012-4-11 18:45
/*请自行先把数据处理好*/
month year   x    y
1    1960  123  321
这是我的数据和修改后的程序,请老师您看下 msva1r.rar (5.13 KB) 本附件包括:
  • MSVAR1.prg
  • xyvar.txt


14
epoh 发表于 2012-4-15 21:13:17
ferguson06 发表于 2012-4-15 20:35
这是我的数据和修改后的程序,请老师您看下
MSVAR1_revised.rar (5.21 KB)
Date:  4/15/12   Initial time: 21:05:09

Start and ending period
       1.0000000        26.000000

Options
      _K,       2.0000000 ,  _M,       2.0000000 ,  _M_V,       2.0000000 ,  
     _Var_opt,       1.0000000 ,  _typmod,       3.0000000 ,  _p,        1.0000000
....
....

Duration of estimation, in secs:  1.70100000


parameter
0.78064822
0.89506957
-0.41293422
1.09166441
-0.19425370
0.46819728
0.65384647
0.07106441
0.11022738
0.08369711
0.24226903
-0.35544298
-0.20933353
0.64755363


=================Final Parameters  ==================


=================Final matrix of markovian transition probabilities P[i,j]: ==================

      0.78064822      0.10493043
      0.21935178      0.89506957

=================Final ergodic probabilities :=================

      0.32357751
      0.67642249

=================Final transposed conditional beta, covariances, var_res by regime, y1..yk series in column :=================

==============Regime      1.00000000=============

Beta
     -0.41293422      1.09166441

Delta

      0.24226903     -0.35544298
     -0.20933353      0.64755363

Sigma

      0.65384647      0.00000000
      0.00000000      0.11022738

==============Regime      2.00000000=============

Beta
     -0.19425370      0.46819728

Delta

      0.24226903     -0.35544298
     -0.20933353      0.64755363

Sigma

      0.07106441      0.00000000
      0.00000000      0.08369711

==============Block matrix of beta, delta,  covariances, by regime, y1..yk series in column :=============

Beta:
     -0.41293422      1.09166441     -0.19425370      0.46819728

Delta:

      0.24226903     -0.35544298      0.24226903     -0.35544298
     -0.20933353      0.64755363     -0.20933353      0.64755363

Sigma:

      0.65384647      0.00000000      0.07106441      0.00000000
      0.00000000      0.11022738      0.00000000      0.08369711


15
ferguson06 发表于 2012-4-16 09:55:18
epoh 发表于 2012-4-15 21:13
Date:  4/15/12   Initial time: 21:05:09

Start and ending period
epoh老师你好~感谢您的回复,我现在发现可能不是我程序出的问题,而是我安装GAUSS的时候,或者是别的什么出了问题,因为我下载了您上传的压缩包,把xyvar放入c\gauss\msvar\data中,把msvar1放入c\gauss\msvar\mslib中,然后运行程序 出来的结果是:
===========================MS OLS and MSVAR Analysis  with MSVARlib - Copyright (C) 2004 by Benoit BELLONE ==================================
Data File MSVARUN

Date:  4/16/12   Initial time:  9:49:19

Start and ending period
       86.000000        530.00000

Options
_K,       1.0000000 ,  _M,       2.0000000 ,  _M_V,       2.0000000 ,  _Var_opt,       2.0000000 ,  _typmod,       1.0000000 ,  _p,        1.0000000
=================Final Results of the Maximum likelihood optimization ==================

Log likelihood   -535.28625631
Convergence code :      0.00000000
The EM algorithm has converged.


Degree of freedom    437.00000000

Number of observations :               443
Number of parameters :                 6


                                Estimates                       Gradient                    Standard-errors                  T-student                    Pvalue.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
X01                             0.889654                      0.000031                      0.043355                     20.520340                      0.000000
X02                             0.976888                     -0.000238                      0.009915                     98.524055                      0.000000
X03                            -1.420622                      0.000233                      0.154901                     -9.171134                      0.000000
X04                             0.307799                     -0.001746                      0.039987                      7.697524                      0.000000
X05                             0.957211                      0.000171                      0.188184                      5.086576                      0.000001
X06                             0.474514                      0.000735                      0.038957                     12.180473                      0.000000

Duration of estimation, in secs6.23000000


parameter
0.88965402
0.97688765
-1.42062150
0.30779920
0.95721128
0.47451354


=================Final Parameters  ==================


=================Final matrix of markovian transition probabilities P[i,j]: ==================

      0.88965402      0.02311235
      0.11034598      0.97688765
。。。。。。
这给我的感觉就是根本就没有运行我想要运行的程序。。然后我发现 可能一直是我在WINDOWS下面那个窗口没改。。。

E%QPQ42V~I{3$N4IDIW54AU.jpg (5.62 KB)

E%QPQ42V~I{3$N4IDIW54AU.jpg

16
ferguson06 发表于 2012-4-16 10:04:27
epoh 发表于 2012-4-15 21:13
Date:  4/15/12   Initial time: 21:05:09

Start and ending period
epoh老师,我有几个问题想请教您。
1、_n_x=1;  和  _n_z=1;这两个为什么选1呢而不是选0?
2、我的数据是原始数据,没有进行过任何差分和导数变化,所以F_option,k_lag和d_option 三个都选0?
3、我结果出来以后,想做个脉冲响应函数,这应该如何实现呢?

17
epoh 发表于 2012-4-16 10:17:02
ferguson06 发表于 2012-4-16 09:55
epoh老师你好~感谢您的回复,我现在发现可能不是我程序出的问题,而是我安装GAUSS的时候,或者是别的什 ...
xyvar.txt  C:\gauss\MSVAR\DATA
MSVAR1.prg C:\gauss\MSVAR\MSlib\Examples

start gauss
   file\change working directory\.......C:\gauss\MSVAR
   file\run program\......C:\gauss\MSVAR\MSlib\Examples\MSVAR1.prg

18
ferguson06 发表于 2012-4-16 10:37:18
epoh 发表于 2012-4-16 10:17
xyvar.txt  C:\gauss\MSVAR\DATA
MSVAR1.prg C:\gauss\MSVAR\MSlib\Examples
谢谢老师~我现在程序已经快而已运行了,呵呵~~就是还有几个小问题想请教你
1、_n_x=1;  和  _n_z=1;这两个为什么选1呢而不是选0?
2、我的数据是原始数据,没有进行过任何差分和导数变化,所以F_option,k_lag和d_option 三个都选0?
3、我结果出来以后,想做个脉冲响应函数,这应该如何实现呢?

19
epoh 发表于 2012-4-16 15:32:59
ferguson06 发表于 2012-4-16 10:37
谢谢老师~我现在程序已经快而已运行了,呵呵~~就是还有几个小问题想请教你
1、_n_x=1;  和  _n_z=1;这两 ...
Q1:_n_x, _n_z,只有在typmod=4 typmod=5 才用得上
      (typmod==4);        
        /* ===   MS-OLS  mix model   y(t)=x(t)*Beta_S(t) +z(t)*delta+u(t) ===  */   
                                 
             x_mat= ( ones(T,1)~ y_data[.,K+1:K+n_x]);
             z_mat= y_data[.,K+n_x+1:K+n_x+n_z];
               
      (typmod==5);                                          
        /* === :MS-OLS Full model    y(t)=x(t)*Beta_S(t) +u(t) ===  */   
      
                x_mat=( ones(T,1)~ y_data[.,K+1:K+n_x]);
                z_mat=zeros(T,1);

Q2:对

Q3:脉冲响应函数,MSVARlib-v2.0没有

20
ferguson06 发表于 2012-4-18 12:40:50
epoh 发表于 2012-4-16 15:32
Q1:_n_x, _n_z,只有在typmod=4 typmod=5 才用得上
      (typmod==4);        
        /* ===   MS- ...
谢谢老师!现在懂了不少,以后有什么不会再向您请教 谢谢啦

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-26 08:38