楼主: drexeldg
93818 271

[程序分享] Oxmetrics   [推广有奖]

11
epoh 发表于 2011-10-14 08:51:10

哈哈!zhangtao兄,执行速度真快

KROTO.OX,我跑出的结果跟你一样,有错.

/*********/
estimate Markov switching VAR's in winrats
/*********/
MARKOV.src
mssetup.src
MSVARSetup.src
excute file:msvar_hamilton.prg
winrats v7 or later.

Markov Switch VAR Setup _winrats.rar (12.13 KB)


/*********/
Classical Estimation of Multivariate
Markov-Switching Models using MSVARlib.pdf

  http://bellone.ensae.net/MSVARlib-v2.0.pdf

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhangtao + 5 + 5 + 5 对epoh大师致以最崇高的敬意!

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

12
zhangtao 发表于 2011-10-14 12:29:00
epoh 发表于 2011-10-14 08:51
哈哈!zhangtao兄,执行速度真快KROTO.OX,我跑出的结果跟你一样,有错./*********/
estimate Markov switchin ...
新建文件夹 (3).rar (11.95 MB)
epoh老师,您好!
    非常感谢您的帮助和指导!
   我想问一下:附件中的.tar.gz,这样的文件我以前没有见过,
想问您一下:这样的文件在scilab中如何运行?
非常感谢!
数学好就是要天天学

13
epoh 发表于 2011-10-14 16:13:04

两者相容性不佳

后续会延伸很多问题.

请选:scilab-5.1.1 & Grocer_V1.5_SCI_5.1moins

Grocer_V1.5_SCI_5.1moins解压缩后

将文件夹grocer放在c碟

开启 scilab

然后输入exec('c:/grocer/loader.sce',-1)

就OK了

**********
GROCER 1.5 installed   

Please, we would greatly appreciate if you could send us an e-mail at grocer.toolbox@free.fr to inform us that you have installed grocer


-->hendryericsson()

ols estimation results for dependent variable: delts(lm1-lp)
estimation period: 1964q3-1989q2
number of observations: 100
number of variables: 5
R2 = 0.7616185  adjusted R2 =0.7515814

Overall F test: F(4,95) = 75.880204       p-value = 0
standard error of the regression: 0.0131293
sum of squared residuals: 0.0163761
DW(0) =2.1774376
Belsley, Kuh, Welsch Condition index: 9

variable                   coeff       t-statistic  p value
delts(lp)                  -0.6870384  -5.4783422   0.0000004
delts(lagts(1,lm1-lp-ly))  -0.1746071  -3.0101342   0.0033444
rnet                       -0.6296264  -10.46405    0
lagts(1,lm1-lp-ly)         -0.0928556  -10.873398   0
cte                         0.0234367   5.818553    7.987D-08

已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhangtao + 5 + 5 + 5 非常感谢epoh大师!

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

14
zhangtao 发表于 2011-10-14 18:25:25
epoh 发表于 2011-10-14 16:13
两者相容性不佳后续会延伸很多问题.请选:scilab-5.1.1 & Grocer_V1.5_SCI_5.1moins Grocer_V1.5_SCI_5.1moi ...
epoh老师,您好!

Grocer_V1.5_SCI_5.1moins解压缩后
Grocer_V1.5_SCI_5.1moins.tar.gz这种文件我还是第一次碰到,
请问如何解压呢?
非常感谢!




数学好就是要天天学

15
epoh 发表于 2011-10-14 18:33:04

就是一般解压缩软件

     ex:winrar

这跟R一样

譬如你要安装 package "coda"

自行由本机安装,下载coda_0.14-4.zip

Windows binary:  coda_0.14-4.zip

要看sourcr code,下载coda_0.14-4.tar.gz   

Package source:  coda_0.14-4.tar.gz  

  http://cran.r-project.org/web/packages/coda/index.html

16
epoh 发表于 2011-10-18 15:44:35

zhangtao兄

今天看了下Oxmetrics6.2,

New features in PcGive 13

发现PcGive 13已经可以做 Regime Switching Models.

( only univariate models allowed)

而且有图形介面,可以存贮各项数据及结果.

Hamilton(1989) MSM(2)-AR(4)的结果如下:

GNP82.xls loaded from C:\Program Files\OxMetrics6\Ox\packages\MSVAR\GNP82.xls


Ox Professional version 6.20 (Windows/U) (C) J.A. Doornik, 1994-2011

---- Switching - PcGive 1.0 session started at 15:21:14 on 18-10-2011 ----


Switching( 1) Modelling DUSGNP by MS_ARMA(2, 4, 0)
              The dataset is: C:\Program Files\OxMetrics6\Ox\packages\MSVAR\GNP82.xls
              The estimation sample is: 1951(2) - 1984(4)

                  Coefficient  Std.Error  t-value  t-prob
AR-1               0.00887396     0.1193   0.0744   0.941
AR-2               -0.0666548     0.1379   -0.483   0.630
AR-3                -0.247527     0.1053    -2.35   0.020
AR-4                -0.201927     0.1068    -1.89   0.061
Constant(0)         -0.351190     0.2721    -1.29   0.199
Constant(1)           1.17192    0.07436     15.8   0.000
sigma                0.768240    0.06658     11.5   0.000
p_{0|0}              0.759808    0.09817     7.74   0.000
p_{0|1}             0.0982972    0.03828     2.57   0.011

log-likelihood    -181.422782
no. of observations       131  no. of parameters           9
AIC.T              380.845565  AIC                2.90721805
mean(DUSGNP)         0.744598  var(DUSGNP)           1.13768

Linearity LR-test Chi^2(3)  =   4.4927 [0.2129]   approximate upperbound: [0.5810]

Transition probabilities p_{i|j} = P(Regime i at t+1 | Regime j at t)
                Regime 0,t   Regime 1,t
Regime 0,t+1       0.75981     0.098297
Regime 1,t+1       0.24019      0.90170

Used uniform probabilities to start recursion
Std.Error based on numerical Hessian matrix
SQPF using numerical derivatives (eps1=0.0001; eps2=0.005):
Strong convergence
Used starting values:
      0.10010     0.029604    -0.023450    -0.052037    -0.049589       1.5506
      0.71075      0.50000      0.50000


probability.png

*******

******

另一种方式是,你也可以由

Oxmetrics6.2执行OxGauss

得到相同的结果:

--------------- OxGauss at 10:28:40 on 19-Oct-2011 ---------------

Ox Professional version 6.21 (Windows/U/MT) (C) J.A. Doornik, 1994-2011

C:\Program Files\OxMetrics6\Ox\packages\hamilton_Markov1\MAXSEEK.oxgauss

Bayesian prior used
a=      0.00000000 b=      0.00000000 c=      0.00000000

Starting values
parameters
       1.0000      0.00000      0.10000      0.00000      0.00000      0.00000
       1.0000       1.5000       1.5000
gradients
       7.6433       6.9143       18.239       12.665      -6.5189      -8.3912
      -17.439       6.4844      -2.2637
Initial function =
     -70.1040525341


Position after 1 BFGS iterations
parameters
       1.0597     0.054018      0.24249     0.098944    -0.050929    -0.065556
      0.86376       1.5507       1.4823
gradients
       5.8327       3.2396       4.6567       3.2141      -7.4655      -4.4619
       3.4274       3.9618      -2.3610
function value =
      -64.723138832
  steplen = 0.0078125
.....
.....

Position after 32 BFGS iterations
Status: Strong convergence
parameters
       1.1635     -0.35881     0.013488    -0.057521     -0.24698     -0.21292
      0.76900       3.0702       1.7539
gradients
-5.9376e-005 -6.3707e-006 -3.3991e-005 -1.2115e-005  9.7600e-006 -2.5202e-005
  1.6503e-005 -2.3185e-006  2.6219e-006
function value =
     -60.8824470816


Value of objective function:        60.882447

Strong convergence using numerical first derivatives


MLE as parameterized for numerical optimization
Coefficients:
       1.1635168      -0.35881175      0.013487704     -0.057520648      
      -0.24698320      -0.21292092       0.76900491        3.0701564        1.7538983

Value of log likelihood:      -60.882447

Gradient vector:
  5.9236484e-005   8.1712415e-006   3.5171865e-005   1.3145041e-005  -1.1013412e-005   
  2.3092639e-005  -1.7763568e-005   9.2574142e-007  -1.4179269e-006

Vector is reparameterized to report final results as follows
Means for each state:
       1.1635168      -0.35881175
Autoregressive coefficients:
     0.013487704     -0.057520648      -0.24698320      -0.21292092
Variances:
      0.59136855

Matrix of Markov transition probabilities:

      0.90408465       0.24532898
     0.095915347       0.75467102

Ergodic probs for full state vector:
      0.48030797      0.050956408      0.013827337      0.042535093      0.013827337     
      0.0014669576    0.011542161      0.035505527      0.013827337      0.0014669576   
      0.00039806804   0.0012245207     0.011542161      0.0012245207     0.0096346448     
      0.029637703     0.050956408      0.0054060220     0.0014669576     0.0045125953     
      0.0014669576    0.00015563116    0.0012245207     0.0037668209     0.042535093     
      0.0045125953    0.0012245207     0.0037668209     0.035505527      0.0037668209      
      0.029637703      0.091170298

Ergodic probs for primitive states:
      0.71892471       0.28107529

Log likelihood:
      -60.882447
For vector of coefficients parameterized as follows,
       1.1635168      -0.35881175      0.013487704     -0.057520648      
      -0.24698320     -0.21292092      0.59136855       0.90408465       0.75467102
the standard errors are
     0.074518858       0.26454067       0.11999444       0.13766334      
     0.10691036        0.11053118       0.10264635       0.037736172     0.096518972


已有 3 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
Sunknownay + 100 + 5 + 1 + 1 + 1 热心帮助其他会员
esir + 1 + 1 + 1 观点有启发
zhangtao + 5 + 5 + 5 感谢epoh大师!

总评分: 经验 + 100  论坛币 + 5  学术水平 + 7  热心指数 + 7  信用等级 + 7   查看全部评分

17
jiaolong321 发表于 2011-10-19 14:06:41
epoh 发表于 2011-10-12 16:06
哈哈!zhangtao兄对此模型也有兴趣我先说明一下:MSVAR for Ox,需要配合旧版的软件GiveWin2 & oxpro340且使用 ...
不知前辈能否提供你的MSVAR  packages     305816514@qq.com   
另外不知你对MSVAR模型的脉冲响应函数是否有研究。可以交流一下

18
zhangtao 发表于 2011-10-19 14:43:42
epoh 发表于 2011-10-18 15:44
zhangtao兄今天看了下Oxmetrics6.2,New features in PcGive 13发现PcGive 13已经可以做 Regime Switching M ...
epoh老师,您好!
       我用的是oxmetrics6.0,我想您一下:这 Regime Switching Models能否在oxmetrics6.0上运行?
要是您方便的话,能否提供这个包并说明一下详细用法?
非常感谢!
数学好就是要天天学

19
epoh 发表于 2011-10-19 16:07:17
开启Oxmetrics

file\open\....\GNP82.xls

click PcGive

Category    选取 Models for time-series data

Model class 选取Regime Switching Models using PcGive

按Formulate  跳出新窗口:

Formulate-Regime Switching Models-gnp82.xls

     选取右边DUSGNP,送往左边

     在左边形成

        Y DUSGNP

        R Constant

按OK跳出新窗口:

Model Settings-Regime Switching Models

  Model type 选取Markov-switching ARMA model

  AR order   选取4

  OK,again OK.


已有 2 人评分学术水平 热心指数 信用等级 收起 理由
sunlinxmu + 2 + 2 + 1 观点有启发
ywh19860616 + 1 + 1 + 1 热心助人

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 2   查看全部评分

20
epoh 发表于 2011-10-19 16:10:04

哈哈!17楼朋友

爱开玩笑.

我都看到你在gauss区块卖

msvar130ex.zip ,msvar130.zip

你应该比我齐全吧!

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-15 23:49