資源簡介
文件包含OLS的LM檢驗代碼,SDM代碼及LM檢驗代碼,SAR檢驗及LM代碼,SEM檢驗及LM代碼等。
代碼片段和文件信息
%?read?data
A=xlsread(‘E:\空間計量經濟學\Elhost-New?Course?Spatial?Econometrics\cigarette.xls‘);
W1=xlsread(‘E:\空間計量經濟學\Elhost-New?Course?Spatial?Econometrics\Spat-Sym-US.xls‘);?%?This?is?a?binary?contiguity?matrix
%?set?dimensions
T=30;?%?number?of?time?periods
N=46;?%?number?of?regions
%?row-normalize?W
W=normw(W1);?%?row-normalize?binary?contiguity?matrix
%?define?dependent?and?independent?variables
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
%?Create?WX?variables
for?t=1:T
????t1=(t-1)*N+1;t2=t*N;
????wx(t1:t2:)=W*x(t1:t2:);
end
%?determine?size?of?the?x?matrix
[nobs?K]=size(x);
display(‘Results?Binary?Contiguity?matrix‘)
%
%?All?models?include?spatial?and?time?period?fixed?effects?(sfe?and?tfe)?(info.)model=3
%?model=0?no?sfe?and?tfe?model=1?only?sfe?model=2?only?tfe
%?----------------------------------------------------------------------------------------
%?OLS?model?without?spatial?interaction?effects
model=3;?%?sfe?+?tfe
[ywithxwithmeannymeannxmeantymeantx]=demean(yxNTmodel);
results=ols(ywithxwith);
vnames=strvcat(‘logcit‘‘logp‘‘logy‘);?%?should?be?changed?if?x?is?changed
prt_reg(resultsvnames);
%?Additional?results
et=ones(T1);
en=ones(N1);
intercept=mean(y)-mean(x)*results.beta;?
sfe=meanny-meannx*results.beta-kron(enintercept);
tfe=meanty-meantx*results.beta-kron(etintercept);
yme?=?y?-?mean(y);
ent=ones(N*T1);
error=y-kron(tfeen)-kron(etsfe)-x*results.beta-kron(entintercept);
rsqr1?=?error‘*error;
rsqr2?=?yme‘*yme;
FE_rsqr2?=?1.0?-?rsqr1/rsqr2?%?r-squared?including?fixed?effects
sige=results.sige*((nobs-K)/nobs);
loglik=-nobs/2*log(2*pi*sige)-1/(2*sige)*results.resid‘*results.resid
%?Direct?and?indirect?effects?already?determined?by?OLS
%?----------------------------------------------------------------------------------------
%?Spatial?lag?model?SAR
info.lflag=0;?%?required?for?exact?results
info.model=3;?%?sfe?+?tfe
info.fe=0;?%?Do?not?print?intercept?and?fixed?effects;?use?info.fe=1?to?turn?on
results=sar_panel_FE(yxWTinfo);?
%?Print?out?coefficient?estimates
vnames=strvcat(‘logcit‘‘logp‘‘logy‘);?%?variable?names
prt_sp(resultsvnames1);
%?Print?out?direct?and?indirect?effects
spat_model=0;?%?0?for?SAR?1?for?SDM/GNS?model
direct_indirect_effects_estimates(resultsWspat_model);
%?----------------------------------------------------------------------------------------
%?Spatial?error?model?SEM
info.lflag=0;?%?required?for?exact?results
info.model=3;?%?sfe?+?tfe
info.fe=0;?%?Do?not?print?intercept?and?fixed?effects;?use?info.fe=1?to?turn?on
results=sem_panel_FE(yxWTinfo);?
%?Print?out?coefficient?estimates
vnames=strvcat(‘logcit‘‘logp‘‘logy‘);?%?variable?names
prt_sp(resultsvnames1);
%?Direct?and?indirect?effects?already?determined?by?SEM
%?--------------------------------------------------------
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????216064??2017-08-29?12:41??Matlab與空間計量\A.xls
?????文件?????100664??2017-08-26?16:46??Matlab與空間計量\elhorst_model.rar
?????文件???????5818??2017-09-10?16:30??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\AAA.m
?????文件???????1164??2008-05-07?17:13??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\beta_cdf.m
?????文件???????1361??2006-07-13?21:17??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\beta_prior.m
?????文件???????1115??2007-07-16?21:18??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\beta_rnd.m
?????文件????????972??2005-07-01?20:49??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\chis_prb.m
?????文件?????217088??2012-05-25?21:51??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\cigarette.xls
?????文件??????25600??2012-05-25?21:53??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\cigar_states.xls
?????文件???????3610??2017-09-12?20:06??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\Course2016cigarette.m
?????文件??????33615??2012-06-25?18:41??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\Data_cigarette_demand.mat
?????文件???????1122??2005-07-05?20:04??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\demean.m
?????文件???????1581??2013-06-18?22:59??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\demeanF.m
?????文件???????3636??2010-10-15?19:35??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\direct_indirect_effects_estimates.m
?????文件????????563??2012-09-12?15:59??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f2_sacpanel.m
?????文件???????1832??2010-10-13?23:02??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f2_sarpanel.m
?????文件???????1881??2010-10-13?23:07??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f2_sempanel.m
?????文件????????494??2012-05-23?23:31??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f_sacpanel.m
?????文件???????1915??2010-10-13?23:01??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f_sarpanel.m
?????文件???????1763??2010-10-13?23:06??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\f_sempanel.m
?????文件???????1230??2006-09-07?18:13??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\invpd.m
?????文件???????1555??2006-04-28?19:09??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\lndetexact.m
?????文件???????1603??2007-04-05?16:29??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\lndetfull.m
?????文件???????2297??2010-12-10?19:17??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\lndetint.m
?????文件???????2763??2006-04-25?21:10??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\lndetmc.m
?????文件??????13455??2013-11-20?23:41??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\log_marginal_panelprob.m
?????文件??????17188??2013-06-25?05:50??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\log_marginal_panelvec.m
?????文件???????1107??2007-07-16?22:20??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\matdiv.m
?????文件???????1106??2001-03-28?06:59??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\matsub.m
?????文件???????9800??2009-06-30?15:53??Matlab與空間計量\Elhost-New?Course?Spatial?Econometrics\mprint.m
............此處省略1303個文件信息
- 上一篇:經濟預測方法及MATLAB實現
- 下一篇:數字圖像處理使用matlab進行幾何變換
評論
共有 條評論