楼主: hanceland
7417 22

[问答] 请教双变量SWARCH CODE运行问题 [推广有奖]

  • 0关注
  • 12粉丝

已卖:419份资源

教授

64%

还不是VIP/贵宾

-

威望
0
论坛币
4867 个
通用积分
39.2214
学术水平
28 点
热心指数
43 点
信用等级
13 点
经验
35066 点
帖子
1371
精华
0
在线时间
1589 小时
注册时间
2006-3-27
最后登录
2025-5-31

楼主
hanceland 发表于 2011-7-24 11:11:30 |AI写论文
50论坛币
最近在尝试运行Hamilton的双变量SWARCH的GAUSS程序,但是在GAUSS9.0下,出现ERROR G0008和 ERROR G00025等路径错误和变量未定义错误,修改路径后继续出现【“: . ”】必须在括号内等错误,以及变量未定义错误。请问各位大侠,如何才能够运行,又如何把数据替代为自己的数据。请帮忙运行和调试一下,谢谢!程序如附件所示。主程序为MAXSEEK。

lin.zip
下载链接: https://bbs.pinggu.org/a-938358.html

50.66 KB

本附件包括:

  • Rvar.fcs
  • 2s.out
  • 2s.pro
  • 2s.smo
  • 2s.var
  • Citi.dat
  • Ergodic
  • Grt.fcs
  • Maxseek.2s
  • Osmfor.out
  • Procs.ext
  • Readme.txt
  • 2s.fil

最佳答案

xuehe 查看完整内容

注意代码什么时候写的,用当时的版本。修改起来也是比较麻烦的,参照在gauss里面的lib里面修改,比较麻烦。
关键词:SWARCH 运行问题 ARCH code ARC 运行 请教 变量 code SWARCH

沙发
xuehe 发表于 2011-7-24 11:11:31
注意代码什么时候写的,用当时的版本。修改起来也是比较麻烦的,参照在gauss里面的lib里面修改,比较麻烦。
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 好的建议,谢谢您

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

藤椅
hanceland 发表于 2011-7-24 11:34:36
相关文章如附件:

双变量SWARCH.rar

319.6 KB

本附件包括:

  • 双变量SWARCH.pdf

板凳
hanceland 发表于 2011-7-24 12:17:00
在使用GAUSS 5.0运行出现:error G0008 : '#include procs' : Syntax error
error G0008 : '#include optmum.ext' : Syntax error

报纸
hanceland 发表于 2011-7-24 20:45:34
还请版主及各位高手指点一下。

地板
xuehe 发表于 2011-7-25 16:47:33
gauss5.0可以的// Welcome to GAUSS 5.0

You've just run the GAUSS startup file.  It's called "startup" in your
GAUSS home directory.  You may modify it to contain your own custom
commands or simply delete it.

To run an example program, enter the following at the command prompt:

run ols.e

?run D:\gausscd\lin\Maxseek.2s;
Order of autoregression for production index       1.0000000
Order of autoregression for stock return       1.0000000
Order of ARCH process      0.00000000
Number of primitive states       2.0000000
Number of lagged states that affect returns and growth rates       1.0000000
Number of state delays between returns and growth rates       1.0000000
First observation used for estimation is       5.0000000
with leverage effect
Distribution is Normal
==================================================
The matrix hpp is

1. 0.0  1. 0.0  1. 0.0  1. 0.0
0.0  1. 0.0  1. 0.0  1. 0.0  1.
1.  1. 0.0 0.0  1.  1. 0.0 0.0
0.0 0.0  1.  1. 0.0 0.0  1.  1.
1.  1.  1.  1. 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0  1.  1.  1.  1.
----------------- 2 STATE MODEL ----------------
================================================
--------- Parameters in the stock return and its volatility eqautions----------

Constant term in stock return regression      0.35000000
Autoregressive coefficients in stoch return regression      0.27145200
Initial variance not neeeded
Constant term in ARCH process       19.663118
(Transposed) matrix of transition probabilities
      0.88730800      0.020626000
      0.11269200       0.97937400

The state with no adjustment to ARCH process is state 1, with transition
probability       0.88730800
Vector of variance factors for states 2 through       2.0000000      0.088103000
Coefficient on negative lagged change for asymmetric effect      0.15921200  
----------- Parameters in the production growth rate eqaution -----------

The mean of  growth rate in state 1 through       2.0000000      -0.76164300       0.41672000
Autocoefficients on the production growth rate equation
      0.23808100
Variance for the growth rate      0.48369000

Initial values:      0.35000000       0.27145200        13.108745       0.88730800       0.97937400      0.088103000      -0.15921200      -0.76164300       0.41672000       0.23808100       0.48369000
Initial value for negative log likelihood:       1259.9470

Do you wish to continue (y or n)?

7
xuehe 发表于 2011-7-25 16:48:40
iteration:  1   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94697    step length:  0.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3500            0.0002
       2             0.2715            0.0002
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0001
       7            -0.1592            0.0000
       8            -0.7616            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  2   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94688    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3502            0.0002
       2             0.2716            0.0001
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0001
       6             0.0882            0.0000
       7            -0.1592            0.0000
       8            -0.7616            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  3   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94683    step length:  0.47617      backsteps:  1  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3505            0.0002
       2             0.2719            0.0000
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0006
       6             0.0883            0.0001
       7            -0.1593            0.0000
       8            -0.7616            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  4   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94674    step length:  0.33623      backsteps:  1  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3511            0.0001
       2             0.2722            0.0001
       3            13.1088            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0001
       6             0.0884            0.0002
       7            -0.1593            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  5   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94668    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3514            0.0001
       2             0.2722            0.0001
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0001
       6             0.0883            0.0001
       7            -0.1594            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  6   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94639    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3540            0.0001
       2             0.2721            0.0001
       3            13.1087            0.0000
       4             0.8874            0.0000
       5             0.9794            0.0000
       6             0.0878            0.0002
       7            -0.1597            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2380            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  7   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94633    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3549            0.0000
       2             0.2719            0.0001
       3            13.1087            0.0000
       4             0.8874            0.0000
       5             0.9794            0.0000
       6             0.0878            0.0002
       7            -0.1597            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2380            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  8   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94626    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3560            0.0000
       2             0.2715            0.0000
       3            13.1088            0.0000
       4             0.8874            0.0000
       5             0.9794            0.0000
       6             0.0880            0.0000
       7            -0.1598            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2380            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  9   
   algorithm: BFGS         step method: STEPBT
   function:  1259.94625    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3560            0.0000
       2             0.2715            0.0000
       3            13.1088            0.0000
       4             0.8874            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0000
       7            -0.1597            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  10  
   algorithm: BFGS         step method: STEPBT
   function:  1259.94625    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3560            0.0000
       2             0.2715            0.0000
       3            13.1088            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0000
       7            -0.1596            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  11  
   algorithm: BFGS         step method: STEPBT
   function:  1259.94625    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3560            0.0000
       2             0.2714            0.0000
       3            13.1088            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0000
       7            -0.1595            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  12  
   algorithm: BFGS         step method: STEPBT
   function:  1259.94624    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3560            0.0000
       2             0.2714            0.0000
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0000
       7            -0.1593            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000

================================================================================
   iteration:  13  
   algorithm: BFGS         step method: STEPBT
   function:  1259.94624    step length:  1.00000      backsteps:  0  
--------------------------------------------------------------------------------
   param.      param. value     relative grad.
       1             0.3561            0.0000
       2             0.2714            0.0000
       3            13.1087            0.0000
       4             0.8873            0.0000
       5             0.9794            0.0000
       6             0.0881            0.0000
       7            -0.1592            0.0000
       8            -0.7617            0.0000
       9             0.4167            0.0000
      10             0.2381            0.0000
      11             0.4837            0.0000


======================================================
          FINAL ESTIMATES

Value of log likelihood:      -1259.9462

Coefficients:
      0.35614458       0.27145451        13.108744       0.88728326       0.97937346      0.088098464      -0.15922159      -0.76170575       0.41670847       0.23808761       0.48368836

----------------- 2 STATE MODEL ----------------
================================================
--------- Parameters in the stock return and its volatility eqautions----------

Constant term in stock return regression      0.35614458
Autoregressive coefficients in stoch return regression      0.27145451
Initial variance not neeeded
Constant term in ARCH process       19.663116
(Transposed) matrix of transition probabilities
      0.88728326      0.020626542
      0.11271674       0.97937346

The state with no adjustment to ARCH process is state 1, with transition
probability       0.88728326
Vector of variance factors for states 2 through       2.0000000      0.088098464
Coefficient on negative lagged change for asymmetric effect      0.15922159  
----------- Parameters in the production growth rate eqaution -----------

The mean of  growth rate in state 1 through       2.0000000      -0.76170575       0.41670847
Autocoefficients on the production growth rate equation
      0.23808761
Variance for the growth rate      0.48368836

Gradient vector:
   0.00016668594     0.0011665524  -6.4212495e-005     -0.010760982    0.00064235718    -0.0048890714   -0.00070323279    -0.0031341755    -0.0028893432     0.0016837808   -0.00054849252
Standard errors:
      0.16962287      0.050153239        1.3786994      0.048649532     0.0095004537      0.041177143       0.10483687       0.13625336      0.055371712      0.055136403      0.038323954

Matrix of Markov transition probabilities:

      0.88728326      0.020626542
      0.11271674       0.97937346

Ergodic probs for full state vector:
      0.12178110      0.015470559    0.00035964178      0.017076232      0.015470559     0.0019653148      0.017076232       0.81080037

Ergodic probs for primitive states:
      0.15468753       0.84531247

Log likelihood:
      -1259.9462


Number of observations below .025 level:
8.0000
Number of observations above .975 level:
13.0000
Loss functions of forecasting the growth rate
      0.55073309       0.54361925
      0.65169570       0.58712564
Loss functions of forecasting the stock volatility
       486.07139        12.868865
       545.16711        10.878132
      0.00000000       0.00000000       0.26244187       0.00000000       0.26772678       0.27077734        2.3769699       0.12683896        3.0859681
?
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
ywh19860616 + 5 + 5 + 5 非常热心,版主,gauss经常出现版本不同,而不能运行,这有什么好的办法可以解决

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

8
ywh19860616 发表于 2011-7-25 17:30:28
xuehe版主,gauss经常出现版本不同,而不能运行,这有什么好的办法可以解决吗
比如您上面在gauss5可以运行,但是在gauss7或者其他版本又不能运行,所以需要修改
我们怎么才能知道是因为版本问题才导致不能运行的,而不是语法错误
一份耕耘,一份收获。

9
hanceland 发表于 2011-7-25 20:02:35

"

谢谢版主的热心帮助,我好好试着运行一下。还是不行,我只有GAUSS5.0 light可用,得不出结果。错误146和147行“N”和“PS”未定义。

10
hanceland 发表于 2011-7-25 23:10:55
谢谢版主,跑出来了,把文件夹定义在LIN文件。

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-8 05:49