基于MATLAB的spatial panel model 程序阅读与学习。-经管之家官网!

人大经济论坛-经管之家 收藏本站
您当前的位置> 软件培训>>

Matlab软件培训

>>

基于MATLAB的spatial panel model 程序阅读与学习。

基于MATLAB的spatial panel model 程序阅读与学习。

发布:tulipsliu | 分类:Matlab软件培训

关于本站

人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!

获取电子版《CDA一级教材》

完整电子版已上线CDA网校,累计已有10万+在读~ 教材严格按考试大纲编写,适合CDA考生备考,也适合业务及数据分析岗位的从业者提升自我。

完整电子版已上线CDA网校,累计已有10万+在读~ 教材严格按考试大纲编写,适合CDA考生备考,也适合业务及数据分析岗位的从业者提升自我。

发此文的目的是通过研读程序,更深入的了解Elhost在写这个程序时的思想,通过认真研读程序,深入掌握空间面板程序建模的问题。%DemonstrationfileforElhorstPanelDatacode%%Datasetdownloadedfromwww.wiley.co.uk/ba ...
免费学术公开课,扫码加入


发此文的目的是通过研读程序,更深入的了解Elhost在写这个程序时的思想,通过认真研读程序,深入掌握空间面板程序建模的问题。
  1. % Demonstration file for Elhorst Panel Data code
  2. %
  3. % Dataset downloaded from www.wiley.co.uk/baltagi/
  4. % Spatial weights matrix constructed by Elhorst
  5. %
  6. % written by: J.Paul Elhorst summer 2010
  7. % University of Groningen
  8. % Department of Economics
  9. % 9700AV Groningen
  10. % the Netherlands
  11. % j.p.elhorst@rug.nl
  12. %
  13. % REFERENCE:
  14. % Elhorst JP (2010) Matlab Software for Spatial Panels. Under review.
  15. %
  16. % Elhorst JP (2010) Spatial Panel Data Models. In Fischer MM, Getis A (Eds.)
  17. % Handbook of Applied Spatial Analysis, Ch. C.2. Springer: Berlin Heidelberg New York.
  18. %
  19. % New:

  20. % 1) Direct/Indirect effect esimates of the explanatory variables
  21. % LeSage JP, Pace RK (2009) Introduction to Spatial Econometrics. Boca Raton, Taylor & Francis Group.
  22. % routine direct_indirect_effects_estimates(results,W,spat_model) is written by J.P. Elhorst
  23. % routines panel_effects_sar(results,vnames,W) and panel_effects_sar(results,vnames,W)
  24. % are written and made available by D. Lacombe
  25. % User may use both routines (note: results are slightly different from each other since they are based on draws from a distrobution
  26. % or choose one particular routine. If N is large, user should choose
  27. % Lacombe's routines, since this one is much more efficient computationally

  28. % 2) Bias correction of coefficient estimates
  29. % Lee Lf, Yu J. (2010) Estimation of spatial autoregressive models with
  30. % fixed effects, Journal of Econometrics 154: 165-185.

  31. % 3) Selection framework to determine which spatial panel data model best
  32. % describes the data.

  33. % dimensions of the problem
  34. load cigarette_mat;
  35. load US_W;
  36. T=30; % number of time periods
  37. N=46; % number of regions
  38. % row-normalize W
  39. W=normw(W1); % function of LeSage
  40. y=A(:,[3]); % column number in the data matrix that corresponds to the dependent variable
  41. x=A(:,[4,6]); % column numbers in the data matrix that correspond to the independent variables
  42. for t=1:T
  43. t1=(t-1)*N+1;t2=t*N;
  44. wx(t1:t2,:)=W*x(t1:t2,:);
  45. end
  46. xconstant=ones(N*T,1);
  47. [nobs K]=size(x);
  48. % ----------------------------------------------------------------------------------------
  49. % No fixed effects + spatially lagged dependent variable
  50. info.lflag=0; % required for exact results
  51. info.model=0;
  52. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  53. % New routines to calculate effects estimates
  54. results=sar_panel_FE(y,[xconstant x],W,T,info);
  55. vnames=char('logcit','intercept','logp','logy');
  56. % Print out coefficient estimates
  57. prt_sp(results,vnames,1);
  58. % Print out effects estimates
  59. spat_model=0;
  60. direct_indirect_effects_estimates(results,W,spat_model);
  61. panel_effects_sar(results,vnames,W);
  62. % ----------------------------------------------------------------------------------------
  63. % No fixed effects + spatially lagged dependent variable + spatially
  64. % independent variables
  65. info.lflag=0; % required for exact results
  66. info.model=0;
  67. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  68. % New routines to calculate effects estimates
  69. results=sar_panel_FE(y,[xconstant x wx],W,T,info);
  70. vnames=char('logcit','intercept','logp','logy','W*logp','W*logy');
  71. % Print out coefficient estimates
  72. prt_sp(results,vnames,1);
  73. % Print out effects estimates
  74. spat_model=1;
  75. direct_indirect_effects_estimates(results,W,spat_model);
  76. panel_effects_sdm(results,vnames,W);
  77. % ----------------------------------------------------------------------------------------
  78. % Spatial fixed effects + spatially lagged dependent variable
  79. info.lflag=0; % required for exact results
  80. info.model=1;
  81. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  82. % New routines to calculate effects estimates
  83. results=sar_panel_FE(y,x,W,T,info);
  84. vnames=char('logcit','logp','logy');
  85. % Print out coefficient estimates
  86. prt_sp(results,vnames,1);
  87. % Print out effects estimates
  88. spat_model=0;
  89. direct_indirect_effects_estimates(results,W,spat_model);
  90. panel_effects_sar(results,vnames,W);
  91. % ----------------------------------------------------------------------------------------
  92. % Spatial fixed effects + spatially lagged dependent variable + spatially
  93. % independent variables
  94. info.lflag=0; % required for exact results
  95. info.model=1;
  96. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  97. % New routines to calculate effects estimates
  98. results=sar_panel_FE(y,[x wx],W,T,info);
  99. vnames=char('logcit','logp','logy','W*logp','W*logy');
  100. % Print out coefficient estimates
  101. prt_sp(results,vnames,1);
  102. % Print out effects estimates
  103. spat_model=1;
  104. direct_indirect_effects_estimates(results,W,spat_model);
  105. panel_effects_sdm(results,vnames,W);
  106. % ----------------------------------------------------------------------------------------
  107. % Time period fixed effects + spatially lagged dependent variable
  108. info.lflag=0; % required for exact results
  109. info.model=2;
  110. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  111. % New routines to calculate effects estimates
  112. results=sar_panel_FE(y,x,W,T,info);
  113. vnames=char('logcit','logp','logy');
  114. % Print out coefficient estimates
  115. prt_sp(results,vnames,1);
  116. % Print out effects estimates
  117. spat_model=0;
  118. direct_indirect_effects_estimates(results,W,spat_model);
  119. panel_effects_sar(results,vnames,W);
  120. % ----------------------------------------------------------------------------------------
  121. % Time period fixed effects + spatially lagged dependent variable + spatially
  122. % independent variables
  123. info.lflag=0; % required for exact results
  124. info.model=2;
  125. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  126. % New routines to calculate effects estimates
  127. results=sar_panel_FE(y,[x wx],W,T,info);
  128. vnames=char('logcit','logp','logy','W*logp','W*logy');
  129. % Print out coefficient estimates
  130. prt_sp(results,vnames,1);
  131. % Print out effects estimates
  132. spat_model=1;
  133. direct_indirect_effects_estimates(results,W,spat_model);
  134. panel_effects_sdm(results,vnames,W);
  135. % ----------------------------------------------------------------------------------------
  136. % Spatial and time period fixed effects + spatially lagged dependent variable
  137. info.lflag=0; % required for exact results
  138. info.model=3;
  139. info.fe=0; % Do not print intercept and fixed effects; use info.fe=1 to turn on
  140. % New routines to calculate effects estimates
  141. results=sar_panel_FE(y,x,W,T,info);
  142. vnames=char('logcit','logp','logy');
  143. % Print out coefficient estimates
  144. prt_sp(results,vnames,1);
  145. % Print out effects estimates
  146. spat_model=0;
  147. direct_indirect_effects_estimates(results,W,spat_model);
  148. panel_effects_sar(results,vnames,W);
复制代码
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
本文关键词:

本文论坛网址:https://bbs.pinggu.org/thread-2119961-1-1.html

人气文章

1.凡人大经济论坛-经管之家转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
数据分析师 人大经济论坛 大学 专业 手机版
联系客服
值班时间:工作日(9:00--18:00)