91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: Matlab
  • 標簽: 空間計量??

資源簡介

本代碼可以計算出空間計量經濟學模型的參數,并做出檢驗!

資源截圖

代碼片段和文件信息

A=wk1read(‘C:\Program?Files\MATLAB\R2010a\elhorst\cigarette.wk1‘10);?%?data?set?with?T=30
W1=wk1read(‘C:\Program?Files\MATLAB\R2010a\elhorst\Spat-Sym-US.wk1‘);
%?Dataset?downloaded?from?www.wiley.co.uk/baltagi/
%?Spatial?weights?matrix?constructed?by?Elhorst
%
%?written?by:?J.Paul?Elhorst?summer?2010
%?University?of?Groningen
%?Department?of?Economics
%?9700AV?Groningen
%?the?Netherlands
%?j.p.elhorst@rug.nl
%
%?REFERENCES:?
%?Elhorst?JP?(2010)?Matlab?Software?for?Spatial?Panels.?Under?review.
%
%?Elhorst?JP?(2010)?Spatial?Panel?Data?Models.?In?Fischer?MM?Getis?A?(Eds.)?
%?Handbook?of?Applied?Spatial?Analysis?Ch.?C.2.?Springer:?Berlin?Heidelberg?New?York.
%
%?dimensions?of?the?problem
T=30;?%?number?of?time?periods
N=46;?%?number?of?regions
%?row-normalize?W
W=normw(W1);?%?function?of?LeSage
y=A(:[3]);?%?column?number?in?the?data?matrix?that?corresponds?to?the?dependent?variable
x=A(:[46]);?%?column?numbers?in?the?data?matrix?that?correspond?to?the?independent?variables
xconstant=ones(N*T1);
[nobs?K]=size(x);
%?----------------------------------------------------------------------------------------
%?ols?estimation?
results=ols(y[xconstant?x]);
vnames=strvcat(‘logcit‘‘intercept‘‘logp‘‘logy‘);
prt_reg(resultsvnames1);
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(resultsWy[xconstant?x]);?%?(Robust)?LM?tests

%?The?lm?tests?developed?by?Donald?Lacombe
%?see?http://www.rri.wvu.edu/lacombe/~lacombe.htm

lm1=lmlag(y[xconstant?x]W);
prt_tests(lm1);

lm2=lmerror_panel(y[xconstant?x]W);
prt_tests(lm2);

lm3=lmlag_robust_panel(y[xconstant?x]W);
prt_tests(lm3);

lm4=lmerror_robust_panel(y[xconstant?x]W);
prt_tests(lm4);

%?----------------------------------------------------------------------------------------
%?spatial?fixed?effects?+?(robust)?LM?tests?for?spatial?lag?and?spatial?error?model
%?fixed?effects?within?estimator
%?demeaning?of?the?y?and?x?variables
model=1;
[ywithxwithmeannymeannxmeantymeantx]=demean(yxNTmodel);
results=ols(ywithxwith);
vnames=strvcat(‘logcit‘‘logp‘‘logy‘);?%?should?be?changed?if?x?is?changed
prt_reg(resultsvnames);
sfe=meanny-meannx*results.beta;?%?including?the?constant?term
yme?=?y?-?mean(y);
et=ones(T1);
error=y-kron(etsfe)-x*results.beta;
rsqr1?=?error‘*error;
rsqr2?=?yme‘*yme;
FE_rsqr2?=?1.0?-?rsqr1/rsqr2?%?r-squared?including?fixed?effects
sige=results.sige*((nobs-K)/nobs);
logliksfe=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid‘*results.resid
LMsarsem_panel(resultsWywithxwith);?%?(Robust)?LM?tests

lm1=lmlag_panel(ywithxwithW);
prt_tests(lm1);

lm2=lmerror_panel(ywithxwithW);
prt_tests(lm2);

lm3=lmlag_robust_panel(ywithxwithW);
prt_tests(lm3);

lm4=lmerror_robust_panel(ywithxwithW);
prt_tests(lm4);
%?-------------------------------------------------------------

評論

共有 條評論