全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
9645 15
2012-02-11
请问哪位高手能帮忙解决这一错误,在下不胜感激!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-2-11 11:11:15
T=14;N=28;y=log(wjx(:,[1]));x=wjx(:,[2,3,4,5,6]);xconstant=ones(N*T,1);[nobs K]=size(x);
results=ols(y, [xconstant x]);
vnames=strvcat('y', 'cons','x1','x2','x3','x4','x5');
prt_reg(results, vnames,1);
sige=results.sige*((nobs-K)/nobs);
loglikols=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'* results.resid
Lmsarsem_panel(results,W,y, [xconstant x]);
I=eye(T);W1=kron(I,W);
res=moran(y,[ xconstant x],W1);
prt(res);

Ordinary Least-squares Estimates
Dependent Variable =             y   
R-squared      =    0.7451
Rbar-squared   =    0.7417
sigma^2        =    0.0014
Durbin-Watson  =    1.1117
Nobs, Nvars    =    392,     6
***************************************************************
Variable      Coefficient      t-statistic    t-probability
cons             2.154693       283.362114         0.000000
x1               0.000002         8.451497         0.000000
x2               0.000004         8.790314         0.000000
x3               0.000002         2.753406         0.006177
x4              -0.385108        -3.296713         0.001069
x5              -0.005860        -3.258346         0.001220


loglikols =

  735.8815

LM test no spatial lag, probability          =    9.4578,    0.002
robust LM test no spatial lag, probability   =    7.3689,    0.007
LM test no spatial error, probability        =  131.7831,    0.000
robust LM test no spatial error, probability =  129.6942,    0.000
Moran I-test for spatial correlation in residuals
                     
Moran I                    0.47245706
Moran I-statistic         12.75797845
Marginal Probability       0.00000000
mean                      -0.00834460
standard deviation         0.03768635

>> info.lflag=0;info.model=0;result=sar_panel_FE(y,x,W,T,info);vnames=strvcat('y','x1','x2','x3','x4','x5');prt_spnew(results, vnames,1);
Wrong # of variable names in prt_sp -- check vnames argument
will use generic variable names

??? Error using ==> prt_spnew at 81
results structure not known by prt_sp function
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-31 10:08:34
我也出现了你这个问题,T=14;N=28;y=log(wjx(:,[1]));x=wjx(:,[2,3,4,5,6]);xconstant=ones(N*T,1);[nobs K]=size(x);
results=ols(y, [xconstant x]);
vnames=strvcat('y', 'cons','x1','x2','x3','x4','x5');
prt_reg(results, vnames,1);
sige=results.sige*((nobs-K)/nobs);
loglikols=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid'* results.resid
Lmsarsem_panel(results,W,y, [xconstant x]);
I=eye(T);W1=kron(I,W);
res=moran(y,[ xconstant x],W1);
prt(res);

Ordinary Least-squares Estimates
Dependent Variable =             y   
R-squared      =    0.7451
Rbar-squared   =    0.7417
sigma^2        =    0.0014
Durbin-Watson  =    1.1117
Nobs, Nvars    =    392,     6
***************************************************************
Variable      Coefficient      t-statistic    t-probability
cons             2.154693       283.362114         0.000000
x1               0.000002         8.451497         0.000000
x2               0.000004         8.790314         0.000000
x3               0.000002         2.753406         0.006177
x4              -0.385108        -3.296713         0.001069
x5              -0.005860        -3.258346         0.001220


loglikols =

  735.8815

LM test no spatial lag, probability          =    9.4578,    0.002
robust LM test no spatial lag, probability   =    7.3689,    0.007
LM test no spatial error, probability        =  131.7831,    0.000
robust LM test no spatial error, probability =  129.6942,    0.000
Moran I-test for spatial correlation in residuals
                     
Moran I                    0.47245706
Moran I-statistic         12.75797845
Marginal Probability       0.00000000
mean                      -0.00834460
standard deviation         0.03768635

>> info.lflag=0;info.model=0;result=sar_panel_FE(y,x,W,T,info);vnames=strvcat('y','x1','x2','x3','x4','x5');prt_spnew(results, vnames,1);
Wrong # of variable names in prt_sp -- check vnames argument
will use generic variable names

??? Error using ==> prt_spnew at 81
results structure not known by prt_sp function
调试很久都没解决,后来发现是因为命令后期改进了,prt_sp原来是6kb,新下的是11kb,你试试这个应该没问题
附件列表

prt_sp.rar

大小:2.09 KB

 马上下载

本附件包括:

  • prt_sp.m

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-31 10:09:37
怎么把你的命令复制下来了~~不好意思,中间略过
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-7-20 17:25:32
楼上的好,我的matlab怎么运行不了LMsarsem_panel,提示有问题,其他的如moran检验没有问题
怎么回事,是不是jplv7包中没有呀
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-6-20 09:46:05
阳光绒绒 发表于 2012-3-31 10:09
怎么把你的命令复制下来了~~不好意思,中间略过
大侠,请教您个问题,我在运行空间效应sarar模型时也出现了和楼主同样的问题,我将您分享的prt_sp.rar下载下来了,运行时还是出现以前的问题,这是怎么回事呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群