楼主: 南冰
96456 299

急:R软件加载程序包tsDyn问题 [推广有奖]

261
zhangtao 发表于 2012-11-3 16:02:37
epoh 发表于 2012-11-3 15:12
抱歉!zhangtao兄,最近较忙,晚回了.
刚抽空看了下
MSVARlib-v2.0并没有你说的库函数(.lib)和source函数 ...
666.rar (328.93 KB)
epoh老师,您好!
         为什么附件 中的examples文件我运行总是提示以下错误,为什么?如何更正?
非常感谢!
          另外,我还是没有明白.lib文件和.dll文件有什么区别和联系。
          另外,编程中(例如java)中的多态是什么?我总是不明白。
Error in ==> Example_MS_Regress_Fit_using_constCoeff at 35
[Spec_Out]=MS_Regress_Fit(dep,indep,k,S,advOpt); % Estimating the model
??? Error using ==> m_Files\checkSize_constCoeff.m
The argument constcoeff.nS_Param{iEq} should be a vector with number of rows equal to the number of non switching parameters (indep matrix)
Error in ==> m_Files\checkSize_constCoeff.m at 24
            error('The argument constcoeff.nS_Param{iEq} should be a vector with number of rows equal to the number of non switching parameters (indep matrix)')
Error in ==> m_Files\MS_Regress_Fit.m at 39
checkSize_constCoeff();
Error in ==> Example_MS_Regress_For at 20
[Spec_Out]=MS_Regress_Fit(dep,indep,k,S,advOpt); % Estimating the model
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Variable 'indep_nS' is used as a command function.
Error in ==> m_Files\MS_Regress_Fit.m at 85
[param]=fmincon(@(param)MS_Regress_Lik(dep,indep_nS,indep_S,param,k,S,advOpt,dispOut),param0, ...
Error in ==> Example_MS_Regress_Simul_and_Fit_2_States at 54
[Spec_Output]=MS_Regress_Fit(dep,indep,k,S,advOpt);
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Variable 'indep_nS' is used as a command function.
Error in ==> m_Files\MS_Regress_Fit.m at 85
[param]=fmincon(@(param)MS_Regress_Lik(dep,indep_nS,indep_S,param,k,S,advOpt,dispOut),param0, ...
Error in ==> Example_MS_Regress_Simul_and_Fit_3_States at 56
[Spec_Output]=MS_Regress_Fit(dep,indep,k,S,advOpt); % fit the model
??? Error using ==> fmincon
FMINCON cannot continue because user supplied objective function failed with the following error:
Variable 'indep_nS' is used as a command function.
Error in ==> m_Files\MS_Regress_Fit.m at 85
[param]=fmincon(@(param)MS_Regress_Lik(dep,indep_nS,indep_S,param,k,S,advOpt,dispOut),param0, ...
Error in ==> Example_MS_Regress_Simul_Fit_2_States_Multivar at 65
[Spec_Out]=MS_Regress_Fit(dep,indep,k,S,advOpt); % Estimating the model
>>
数学好就是要天天学

262
zhangtao 发表于 2012-11-3 17:17:54
c:\gauss10\src\mvt.src(44) : error G0432 : 'c:\gauss10\dlib\mvt1.dll' : Error opening dynamic library
LoadLibrary error 126 occurred

c:\gauss10\src\mvt.src(44) : error G0432 : 'c:\gauss10\dlib\mvt2.dll' : Error opening dynamic library
为什么附件中的gauss程序在gauss10中运行会出现以错误?

gauss-mvt.zip
下载链接: https://bbs.pinggu.org/a-1204554.html

245.46 KB

本附件包括:

  • gauss-mvt\dlib\mvt1.dll
  • gauss-mvt\dlib\mvt2.dll
  • gauss-mvt\lib\MVT.LCG
  • gauss-mvt\mvt\dlls\mvt.bat
  • gauss-mvt\mvt\dlls\mvt.c
  • gauss-mvt\mvt\dlls\mvt.f
  • gauss-mvt\mvt\dlls\mvt1.c
  • gauss-mvt\mvt\dlls\mvt1.dll
  • gauss-mvt\mvt\dlls\mvt1.exp
  • gauss-mvt\mvt\dlls\mvt1.lib
  • gauss-mvt\mvt\dlls\mvt1.obj
  • gauss-mvt\mvt\dlls\mvt2.c
  • gauss-mvt\mvt\dlls\mvt2.dll
  • gauss-mvt\mvt\dlls\mvt2.exp
  • gauss-mvt\mvt\dlls\mvt2.lib
  • gauss-mvt\mvt\dlls\mvt2.obj
  • gauss-mvt\mvt\dlls\mvtdstpack.c
  • gauss-mvt\mvt\dlls\mvtdstpack.f
  • gauss-mvt\mvt\MVT1.OUT
  • gauss-mvt\mvt\mvt1.prg
  • gauss-mvt\mvt\MVT2.OUT
  • gauss-mvt\mvt\mvt2.prg
  • gauss-mvt\mvt\MVT3.OUT
  • gauss-mvt\mvt\mvt3.prg
  • gauss-mvt\mvt\MVT4.OUT
  • gauss-mvt\mvt\mvt4.prg
  • gauss-mvt\readme.mvt
  • gauss-mvt\src\mvt.dec
  • gauss-mvt\src\mvt.ext
  • gauss-mvt\src\mvt.src
  • gauss-mvt\license.txt

数学好就是要天天学

263
epoh 发表于 2012-11-3 18:24:20
zhangtao 发表于 2012-11-3 16:02
epoh老师,您好!
         为什么附件 中的examples文件我运行总是提示以下错误,为什么?如何更正?
...
1.程序可以正常运转
2."java的多态",不太懂这句话的意思,请用英文表达
3.抱歉!目前我的computer没安装Gauss,
   Error opening dynamic library
    可能是你没有把 mvt1.dll,mvt2.dll
    放进dlib folder
%%%%%%%%%%
set path\add with subfolders\MS_Regress_FEX
>> Example_MS_Regress_Fit_using_constCoeff
Calculating Standard Error Vector...


***** Numerical Optimization Converged *****

Final log Likelihood: 2425.7305
Number of estimated parameters: 6
Type of Switching Model: Univariate
Distribution Assumption -> Normal
Method SE calculation -> 1

***** Final Parameters for Equation #1 *****

---> Non Switching Parameters <---

Non Switching Parameter for Equation #1, Indep column 1
     Value:                0.0000
     Std Error (p. value): Inf (1.00)

--->   Switching Parameters (Distribution Parameters)  <---

State 1
    Model's Variance:      0.000100
    Std Error (p. value):  NaN (NaN)
State 2
    Model's Variance:      0.000459
    Std Error (p. value):  0.0000 (0.00)

--->   Switching Parameters (Regressors)  <---

Switching Parameters for Equation #1 - Indep column 2

State 1
   Value:                0.0000
   Std Error (p. value): NaN (NaN)
State 2
   Value:                0.5339
   Std Error (p. value): 0.0267 (0.00)

Switching Parameters for Equation #1 - Indep column 3

State 1
   Value:                0.9869
   Std Error (p. value): 0.0898 (0.00)
State 2
   Value:                0.0000
   Std Error (p. value): NaN (NaN)

---> Transition Probabilities Matrix (std. error, p-value) <---

      0.95 ( NaN, NaN)   0.01 (0.00,0.22)   
      0.05 ( NaN, NaN)   0.99 (0.04,0.00)   

---> Expected Duration of Regimes <---

     Expected duration of Regime #1: 20.00 time periods
     Expected duration of Regime #2: 181.35 time periods

264
epoh 发表于 2012-11-3 20:16:10
zhangtao 发表于 2012-11-3 17:17
c:\gauss10\src\mvt.src(44) : error G0432 : 'c:\gauss10\dlib\mvt1.dll' : Error opening dynamic librar ...
我刚重新安装GAUSS9.0,
试了可以运行出结果:
     Upper    cdfmvt      cdft     diff.
=========================================
    -3.000     0.048     0.048     0.000
    -2.500     0.065     0.065     0.000
    -2.000     0.092     0.092     0.000
    -1.500     0.136     0.136     0.000
    -1.000     0.211     0.211     0.000
    -0.500     0.333     0.333     0.000
     0.000     0.500     0.500     0.000
     0.500     0.667     0.667     0.000
     1.000     0.789     0.789     0.000
     1.500     0.864     0.864     0.000
     2.000     0.908     0.908     0.000
     2.500     0.935     0.935     0.000
     3.000     0.952     0.952     0.000


     Upper  cdfmvtnc    cdftnc     diff.
=========================================
    -3.000     0.002     0.002     0.000
    -2.500     0.003     0.003     0.000
    -2.000     0.005     0.005     0.000
    -1.500     0.008     0.008     0.000
    -1.000     0.014     0.014     0.000
    -0.500     0.029     0.029     0.000
     0.000     0.067     0.067     0.000
     0.500     0.152     0.152     0.000
     1.000     0.287     0.287     0.000
     1.500     0.436     0.436     0.000
     2.000     0.566     0.566     0.000
     2.500     0.666     0.666     0.000
     3.000     0.740     0.740     0.000
请务必依照第一页指示,放置文件

target path          readme.mvt
target path\dlib     Dynamic link libraries
target path\lib      Library file
target path\mvt      Examples and tutorial files
target path\mvt\dlls Fortran/C source code files
target path\src      GAUSS source code files

你的target path就是
c:\gauss10
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
南冰 + 5 + 5 + 5 顶!

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

265
liufayue 发表于 2012-11-26 06:49:32
质量很高的讨论贴 强烈赞一个

266
epoh 发表于 2012-11-30 20:22:52
雁茗轩 发表于 2012-9-6 09:42
哦,我明白您的意思了!我对Y是进行了零均值化和X-12季节调整的,可能是期中的这种Cycle就显示不出来了, ...
今天恰巧有人问我底下这篇文献,
cyclical component如何画出来.
Markov机制转换的状态空间模型及其在我国经济周期中的应用研
  http://wenku.baidu.com/view/0cdd2961a45177232f60a2fb.html

我想到这篇文献对你应有帮助
Nonlinearities over the business cycle_banco
       http://www.bportugal.pt/en-US/BdP%20Publications%20Research/WP200309.pdf
这篇文献就是用smooth transition autoregressive (STAR) model

已有 2 人评分学术水平 热心指数 信用等级 收起 理由
南冰 + 5 + 5 + 5 热心帮助其他会员
kk22boy + 5 + 5 + 5 热心帮助其他会员

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

267
雁茗轩 发表于 2012-12-1 09:55:20
epoh 发表于 2012-11-30 20:22
今天恰巧有人问我底下这篇文献,
cyclical component如何画出来.
Markov机制转换的状态空间模型及其在 ...
太感谢您了!好的,我下载了一定好好看,谢谢啦

268
yhw12345 发表于 2013-2-7 18:44:04
epoh老师确实懂得很多,不知道能给出stata的estar程序就好了!

269
geokaran 发表于 2013-3-14 01:08:31
good

270
心若灿烂 发表于 2013-3-25 00:29:40
南冰 发表于 2010-10-15 00:03
您好!麻烦您帮我看一下下面的程序,我在R中估计LSTAR模型时,估计的很顺利,但是我想查看中间过程中产生的 ...
你好:我用你的数据和方法,得到了结果确不同与你的,我的tsDyn是9.o版的。结果如下:
>svpdx <- read.table("data.txt", header = TRUE)
>svpdx
    cpi  rpi          m2
1   3.4  2.9  0.26524514
2   6.4  5.4  0.31278198
3  14.7 13.2  0.37310154
4  24.1 21.7  0.34529154
5  17.1 14.8  0.29467111
6   8.3  6.1 -0.03867458
7   2.8  0.8  0.34668927
8  -0.8 -2.6  0.17245702
9  -1.4 -3.0  0.14411363
10  0.4 -1.5 -0.31433668
11  0.7 -0.8  0.87572994
12 -0.8 -1.3  0.16337324
13  1.2 -0.1  0.19679602
14  3.9  2.8  0.18161695
15  1.8  0.8  0.14387323
16  1.5  1.0  0.18886459
17  4.8  3.8  0.15787746
18  5.9  5.9  0.18875571
19 -0.7 -1.2  0.18736354
> x=svpdx$cpi
> y=svpdx$rpi
> z=svpdx$m2
> library(tsDyn)
>ndx.lstar <- lstar(x, m=3,d=1, thVar=z,control=list(maxit=3000))
(使用此命令得到的结果与你的上述结果有很大有不同,特别是gamma值= 330.0193)结果如下:
Using maximum autoregressive order for low regime: mL = 3
Using maximum autoregressive order for high regime: mH = 3
Using only first 16 elements of thVar
Performing grid search for starting values...
Starting values fixed: gamma =  100 , th =  0.2919505 ; SSE =  103.1979
Grid search selected lower/upper bound gamma (was:  1 100 ]).
                                          Might try to widen bound with arg: 'starting.control=list(gammaInt=c(1,200))'
Convergence problem code 1. You might want to increase maximum number of iterations by setting 'control=list(maxit=1000)'
Optimized values fixed for regime 2  : gamma =  330.0193 , th =  0.2820525 ; SSE =  90.99445
> summary(ndx.lstar)

Non linear autoregressive model

LSTAR model
Coefficients:
Low regime:
    const1     phi1.1     phi1.2     phi1.3
-0.7398994  1.8526579 -1.2560973  0.7310564
High regime:
    const2     phi2.1     phi2.2     phi2.3
2.7868701 -1.0567428  1.0397095 -0.8612935
Smoothing parameter: gamma = 330
Threshold
Variable: external
Value: 0.2821
Residuals:
     Min       1Q   Median       3Q      Max
-5.95810 -1.28246 -0.17115  1.28210  4.00887
Fit:
residuals variance = 4.789,  AIC = 50, MAPE = 132%
Coefficient(s):
         Estimate  Std. Error  t value  Pr(>|z|)   
const1  -0.739899    0.995576  -0.7432  0.457368   
phi1.1   1.852658    0.257118   7.2055 5.784e-13 ***
phi1.2  -1.256097    0.581746  -2.1592  0.030836 *  
phi1.3   0.731056    0.318841   2.2929  0.021856 *  
const2   2.786870    2.025909   1.3756  0.168941   
phi2.1  -1.056743    0.347791  -3.0384  0.002378 **
phi2.2   1.039710    0.661091   1.5727  0.115784   
phi2.3  -0.861293    0.390391  -2.2062  0.027368 *  
gamma  330.019336  315.129183   1.0473  0.294984   
th       0.282053    0.013939  20.2354 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Non-linearity test of full-order LSTAR model against full-order AR model
F = 0.11978 ; p-value = 0.94616
Threshold
Variable: external>
我的问题是:
    1、这是多变量的LSTAR模型(平滑转换)。为什么在LSTAR中体现不同系列的不稳性问题呢,或者是不需要作平稳性检验??
    2、我们知道在对作平滑转换模型前,要对基本的回归作非线性检验。这里看不到这一点;是不是不需要这一过程,或含在过程中!
    3、过程中说:Performing grid search for starting values.也即晶格搜索过程;我不知道这一过程的机理,你能不能写出这个过程的程序来;如何选择的!?
    4、这一转换变除X以外的变量z。如是转换变量是Z的滞后项时,又如何办法。是不是程序中也对转换烃量Z及其滞后有选择!如果没有的话,我们要作出是Z的滞后项时,又如何选择呢?
    谢谢!
   
    2、

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

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