楼主: 飘零的枫叶
51488 206

[问答] 用lingo软件如何对DEA-DA模型进行编程 [推广有奖]

101
zhangtao 发表于 2011-7-26 22:40:30
100# epoh
运行TVmodel中的TVCmodel-final文件夹中的:TVCestimate_Figures3_4.m,提示以下错误,请问epoh老师,您看如何解决呢?非常感谢!

Step 1: Import data and run OLS regressions ...
Step 2: Run OLS regressions and estimate variance of shocks ...
Quandt Liklihood ratio test statistic: 8.0599
Step 3: HP filter series ...
Step 4: Run Kalman filter and smoother ...

convert rhos into quarterly frequency ...

??? Undefined command/function 'nancov'.

Error in ==> TVCestimate_Figures3_4 at 285

SVstate_LR_M(i,:,:)=nancov(store_draws);


>>

epoh老师,为什么附件中的程序没有一个可以运行?如何可以运行每一个程序?
我近期要用这些程序,希望帮忙,非常感谢!
TVmodel.rar (156.24 KB)
下载次数:1
2011-7-22 16:36

TVmodel.rar在77楼,从以下链接可以下载:
本文来自: 人大经济论坛 Matlab及其他计量软件专版 版,详细出处参考:https://bbs.pinggu.org/viewthread.php?tid=1127506&page=8&from^^uid=11232
数学好就是要天天学

102
zhangtao 发表于 2011-7-26 22:41:53
Epoh老师,您好!您看以下问题如何解决?我想了很多办法,还是无法解决!
非常感谢您!
运行bootStrap.ssc提示以下错误:

# load resample library

module(resample)

Problem in module(resample): C:/PROGRAM FILES/INSIGHTFUL/splus80\module\resample is not a valid S-PLUS database

Use traceback() to see the call stack

bootStrap.rar
下载链接: https://bbs.pinggu.org/a-939149.html

1.5 KB

本附件包括:

  • bootStrap.ssc

数学好就是要天天学

103
zhangtao 发表于 2011-7-26 22:54:15
另外,epoh老师,您好!
    我的splus8.04没有resample这个模块,您看应该怎么解决呢?
非常感谢!
数学好就是要天天学

104
epoh 发表于 2011-7-27 09:08:00
%%%TVCmodel-final
我用matlab 7.6.0(matlab2008a)
执行TVCestimate_Figures3_4 没啥问题
一直到line at 474
数据产生NaN or Inf.才终止.
  Input to EIG must not contain NaN or Inf.
  Error in ==> TVCestimate_Figures3_4 at 474
               beta79=beta79a+(V79^.5)*rd;


time period = 17
beta79a =
  1.0e+015 *
    0.0000
    0.0000
    0.0000
   -1.1529
    1.1529
   -0.0000


V79 =

  1.0e+033 *
    0.0000    0.0000    0.0000   -0.0000    0.0000   -0.0000
    0.0000    0.0000    0.0000   -0.0000    0.0000   -0.0000
    0.0000    0.0000    0.0000   -0.0000    0.0000   -0.0000
   -0.0000   -0.0000   -0.0000    1.3292   -1.3292   -0.0000
    0.0000    0.0000    0.0000   -1.3292    1.3292    0.0000
   -0.0000   -0.0000   -0.0000   -0.0000    0.0000    0.0000


time period = 18
beta79a =
    2.1541
    0.9443
    0.5065
       Inf
       Inf
       Inf


V79 =

    0.3643    0.2281    0.0524       NaN       NaN       NaN
    0.2281    0.2093    0.0314       NaN       NaN       NaN
    0.0524    0.0314    0.0190       NaN       NaN       NaN
       NaN       NaN       NaN       NaN       NaN       NaN
       NaN       NaN       NaN       NaN       NaN       NaN
       NaN       NaN       NaN       NaN       NaN       NaN



FIGURE 3 'Smoother point long-run response estimates and confidence bands'

  
   FIGURE 3.jpg


执行TVCestimate_Figures3_4
还需要安装Curve Fitting Toolbox

建议你最起码安装matlab 7.6.0(matlab2008a)
可以省掉一些麻烦


nancov.m
   nancov.rar (2.01 KB) 本附件包括:
  • nancov.m



#######bootStrap.ssc
#install pacakge "resample"
in s-plus command window:
  install.pkgutils()
  library(pkgutils)
  install.packages("resample")

安装完后,
要先建立data:cerExample
  cerExample.xls

   cerExample.xls (11.5 KB)

# To load the data into S-PLUS
# File/Import Data/From File
# Click [Browse] and select the file cerExample.xls
# Name the Data set cerExample
# Click Options tab, and uncheck box next to Strings as factors
# Click Okay to load the data into the data.frame cerExample

library("resample")
module("finmetrics")
td = timeSeq(from="7/1/1992",to="11/1/2000",by="months",format="%b %Y")-1
cerExample.ts = timeSeries(positions=td,data=cerExample)
source("bootStrap.ssc")

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

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

105
zhangtao 发表于 2011-7-27 16:16:30
104# epoh

# load resample library
module(resample)
Problem in module(resample): C:/PROGRAM FILES/INSIGHTFUL/splus80\module\resample is not a valid S-PLUS database
Use traceback() to see the call stack
epoh老师,您好!
      我的splus8.04没有resample这个module,
所以会提示以上问题,您看怎么解决?
数学好就是要天天学

106
epoh 发表于 2011-7-27 16:58:37
104楼已告知zhangtao兄
要先安装pacakge "resample"
#install pacakge "resample"
#in s-plus command window:
  install.pkgutils()
  library(pkgutils)
  install.packages("resample")

安装完,以后要载入
library("resample")

107
zhangtao 发表于 2011-7-27 17:10:02
x(:,4) = sum(x,2);     % introduce correlation
epoh老师,您好! x(:,4) = sum(x,2)是什么意思?
x = randn(30,4);       % uncorrelated data
%       x(:,4) = sum(x,2);     % introduce correlation
%       x(2,3) = NaN;          % introduce one missing value
%       c = nancov(x)          % compute sample covariance
数学好就是要天天学

108
zhangtao 发表于 2011-7-27 17:13:20
x = randn(30,4);       % uncorrelated data
    x(:,4) = sum(x,2);     % introduce correlation
    x(2,3) = NaN;          % introduce one missing value
    c = nancov(x)          % compute sample covariance
epoh老师,您好!我想调用localcov.m函数计算以上x的localcov,如何修改和调用以下函数?
function [c,n] = localcov(x,domle)
%LOCALCOV Compute cov with no error checking and assuming NaNs are removed

[m,n] = size(x);
if domle
   denom = m;
else
   denom = max(0,m-1);
end

if m==1   % and doing mle, be sure to get exact 0
   c = zeros(n,class(x));
elseif denom==0
   c = NaN(n,class(x));
else
   xc = x - repmat(mean(x),m,1);
   c = xc' * xc / denom;
end
数学好就是要天天学

109
epoh 发表于 2011-7-27 18:55:15
先说明x(:,4) = sum(x,2);
%B = sum(A,dim)
%dim=1,sum of each column
%dim=2,sum of each row
x = randn(5,3)
x =
   -0.9812   -0.5062    1.7357
   -0.6885    1.6197    1.9375
    1.3395    0.0809    1.6351
   -0.9092   -1.0811   -1.2559
   -0.4129   -1.1245   -0.2135

%增加了第四column
%sum of each row
x(:,4) = sum(x,2)
x =
   -0.9812   -0.5062    1.7357    0.2483  (-0.9812 +(-0.5062)+1.7357)
   -0.6885    1.6197    1.9375    2.8687
    1.3395    0.0809    1.6351    3.0554
   -0.9092   -1.0811   -1.2559   -3.2462
   -0.4129   -1.1245   -0.2135   -1.7509

x(2,3) = NaN  
x =
   -0.9812   -0.5062    1.7357    0.2483
   -0.6885    1.6197       NaN    2.8687
    1.3395    0.0809    1.6351    3.0554
   -0.9092   -1.0811   -1.2559   -3.2462
   -0.4129   -1.1245   -0.2135   -1.7509

%%%%%%%%%%%%%%%%%%

x = randn(30,4);       % uncorrelated data
x(:,4) = sum(x,2);     % introduce correlation
x(2,3) = NaN;          % introduce one missing value
c = nancov(x)          % compute sample covariance
调用localcov.m函数计算以上x的localcov
照function定义应该remove NaNs
但不移除,也不会产生错误.
domle设置为 0 , or 1
localcov(x,0)
c =
    0.9065   -0.0918       NaN    0.9206
   -0.0918    0.8793       NaN    0.6173
       NaN       NaN         NaN       NaN
    0.9206    0.6173       NaN    3.2602

localcov(x,1)
c =
    0.8763   -0.0887       NaN    0.8899
   -0.0887    0.8500       NaN    0.5967
       NaN       NaN          NaN       NaN
    0.8899    0.5967       NaN    3.1516
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhangtao + 5 + 5 + 5 好的意见建议

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

110
zhangtao 发表于 2011-7-28 09:52:46
104# epoh

epoh老师,您好!
   nancov.m
    nancov.rar (2.01 KB) 这个程序装上后,运行很好,我想问一下:nancov.m这个程序您是在那儿找到的?我的matlab上为什么没有?
   


本文来自: 人大经济论坛 Matlab及其他计量软件专版 版,详细出处参考:https://bbs.pinggu.org/viewthread.php?tid=1127506&page=11&from^^uid=11232
数学好就是要天天学

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-14 07:05