楼主: 余可
9766 15

[问答] 用Matlab运算空间面板数据时出现了results structure not known by prt_sp function [推广有奖]

11
miricalCS 发表于 2015-7-25 17:36:48
非常感谢~~~~~

12
saber幽戏 发表于 2016-1-25 10:36:14
黑白电视机 发表于 2013-6-24 22:55
应该是由于参数个数不对应,你检查一下是否包含constant 然后变量个数是否和前面定义的一致
% ols estimation
results=ols(y,[xconstant x]);
vnames=char('y','intercept','x1','x2','x3','x4');
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;

尝试将 SCRIPT ols 作为函数执行:
D:\。。。。。\ols.m

出错 ols (line 30)
results=ols(y,[xconstant x]);

你好,我想请问一下算到这里就出问题了,是哪里不对吗

13
matlab-007 发表于 2016-8-27 20:49:57
运行后 会有提示 请选择 add path

14
夜夜澄波连月色4 发表于 2016-11-12 15:46:06
阳光绒绒 发表于 2012-3-31 10:08
我也出现了你这个问题,T=14;N=28;y=log(wjx(:,[1]));x=wjx(:,[2,3,4,5,6]);xconstant=ones(N*T,1);[nobs K ...
这个下载了以后怎么用啊

15
leichunyan1233 发表于 2017-12-6 20:20:30
出现同样的问题,解释变量选择两个的话就没有问题,多加一个解释变量就出现了问题,例如我的三个解释变量会出现:
代码:T=10;
N=16;
W=normw(W1);
y=A(:,3);
x=A(:,[4,6]);
xconstant=ones(N*T,1);
[nobs K]=size(x);
results=ols(y,[xconstant x]);
vnames=strvcat('y','intercept','x1','x2','x3');
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
% The (robust)LM tests developed by Elhorst
LMsarsem_panel(results,W,y,[xconstant x]); % (Robust) LM tests
结果出现了:
Wrong # of variable names in prt_reg -- check vnames argument
will use generic variable names

Ordinary Least-squares Estimates
R-squared      =    0.2004
Rbar-squared   =    0.1902
sigma^2        =    0.0017
Durbin-Watson  =    0.4011
Nobs, Nvars    =    160,     3
***************************************************************
Variable        Coefficient      t-statistic    t-probability
variable 1         0.078386        16.458904         0.000000
variable 2         0.000038         4.919880         0.000002
variable 3        -0.000347        -4.332922         0.000026


loglikols =

  286.1946

LM test no spatial lag, probability          =  247.2800,    0.000
robust LM test no spatial lag, probability   =  181.9879,    0.000
LM test no spatial error, probability        =  169.5590,    0.000
robust LM test no spatial error, probability =  104.2669,    0.000

16
珊珊来吃^^ 发表于 2018-6-16 12:32:42
阳光绒绒 发表于 2012-3-31 10:08
我也出现了你这个问题,T=14;N=28;y=log(wjx(:,[1]));x=wjx(:,[2,3,4,5,6]);xconstant=ones(N*T,1);[nobs K ...
感谢感谢~~

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

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