资源简介
空间计量的MATLAB在原来的jpl基础上可以做面板SDM
代码片段和文件信息
D=wk1read(‘DataOZBl.wk1‘11); % read data
W1=wk1read(‘Wcex1.wk1‘); %read first part of W
W2=wk1read(‘Wcex2.wk1‘); %read second part of W
W3=[W1W2]; %combine these parts
[DA dim]=sortrows(D[91]);
W=W3(dimdim);
clear W1; clear W2; clear W3; clear D; % W12 3 and D are not used any more
W1=normw(W); %normalize W routine of LeSage‘s website www.spatial-econometrics.com
lambda=eig(W1); %eigenvalues
rmin=min(lambda);
rmax=max(lambda);
N=496; %number of spatial units
y=DA(:14); % dependent variable
x=DA(:[1231012]); % independent variables
const=ones(4961);
dumb=DA(:9);
duma=1-dumb;
x=[duma dumb x];
nvar=size(x2);
% ols estimator
results=ols(yx); %routine from LeSage‘s website www.spatial-econometrics.com
vnames=char(‘ozb‘‘duma‘‘dumb‘‘inkomen‘‘rechts‘‘taxprice‘‘lihh‘‘wrdwon‘); %names of variables
prt_reg(resultsvnames); %routine from LeSage‘s website www.spatial-econometrics.com
% sar one regime programmed myself
n=length(y);
Wy = W1*y;
AI = x‘*x;
b0 = AI\(x‘*y);
bd = AI\(x‘*Wy);
e0 = y - x*b0;
ed = Wy - x*bd;
epe0 = e0‘*e0;
eped = ed‘*ed;
epe0d = ed‘*e0;
options.Display=‘off‘;
options.MaxFunEvals=1000;
options.MaxIter=1000;
options.TolX=0.001;
options.TolFun=0.001;
rho = fminbnd(‘f_sarpaul‘rminrmaxoptionslambdaepe0epedepe0dn);
results.beta = b0 - rho*bd;
results.rho = rho;
bhat = results.beta;
results.sige = (1/n)*(e0-rho*ed)‘*(e0-rho*ed);
sige = results.sige;
results.yhat = (eye(n) - rho*W1)\(x*results.beta);
results.resid = y - results.yhat;
parm = [results.beta
results.rho
results.sige];
bout= [results.beta
results.rho];
results.lik = f2_sarpaul(parmyxW1lambda);
% asymptotic t-stats based on information matrix
% (pp. 80-81 Anselin 1980)
B = eye(n) - rho*W1;
BI = inv(B); WB = W1*BI;
pterm = trace(WB*WB + WB*WB‘);
xpx = zeros(nvar+2nvar+2); % bhatbhat
xpx(1:nvar1:nvar) = (1/sige)*(x‘*x); % bhatrho
xpx(1:nvarnvar+1) = (1/sige)*x‘*W1*BI*x*bhat;
xpx(nvar+11:nvar) = xpx(1:nvarnvar+1)‘; % rhorho
xpx(nvar+1nvar+1) = (1/sige)*bhat‘*x‘*BI‘*W1‘*W1*BI*x*bhat + pterm;
xpx(nvar+2nvar+2) = n/(2*sige*sige); %sigesige
xpx(nvar+1nvar+2) = (1/sige)*trace(WB); % rhosige
xpx(nvar+2nvar+1) = xpx(nvar+1nvar+2);
xpxi = xpx\eye(size(xpx));
tmp = diag(xpxi(1:nvar+11:nvar+1));
bvec = [results.beta
results.rho];
tmp = bvec./(sqrt(tmp));
results.tstat = tmp;
ym = y - mean(y); % r-squared rbar-squared
rsqr1 = results.resid‘*results.resid;
rsqr2 = ym‘*ym;
results.rsqr = 1.0-rsqr1/rsqr2; % r-squared
rsqr1 = rsqr1/(n-nvar);
rsqr2 = rsqr2/(n-1.0);
results.rbar = 1 - (rsqr1/rsqr2); % rbar-squared
%print
fid=1;
vnames=char(‘ozb‘‘duma‘‘dumb‘‘inkomen‘‘rechts‘‘taxprice‘‘lihh‘‘wrdwon‘‘rho‘); %names of variables
fprintf(fid‘\n‘);
fprintf(fid‘sar\n‘);
fprintf(fid‘Dependent Variable = %16s \n‘vnames(1:));
fprintf(fid‘R-squared = %9.4f \n‘results.rsqr);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-08-03 17:14 Elhorst_Panel_Code\
文件 7529 2011-05-30 15:21 Elhorst_Panel_Code\allersdumregime.m
文件 28587 2011-01-14 15:54 Elhorst_Panel_Code\cigardemo.wk1
文件 124885 2011-01-14 15:53 Elhorst_Panel_Code\cigarette.wk1
文件 33615 2011-05-30 13:11 Elhorst_Panel_Code\cigarette_mat.mat
文件 1122 2010-01-14 09:18 Elhorst_Panel_Code\demean.m
文件 10496 2011-05-30 15:10 Elhorst_Panel_Code\demodynfeerror.m
文件 5938 2012-06-01 16:52 Elhorst_Panel_Code\demoLM.m
文件 5482 2011-05-30 15:14 Elhorst_Panel_Code\demoLMsarsem_panel.m
文件 13771 2011-05-30 12:58 Elhorst_Panel_Code\demopanelscompare.m
文件 1521 2011-05-30 15:19 Elhorst_Panel_Code\demoserialspat.m
文件 13937 2012-06-14 13:39 Elhorst_Panel_Code\DemoYanMin.m
文件 1234 2011-06-02 15:38 Elhorst_Panel_Code\Demo_panel_sarregime.m
文件 3669 2011-09-06 20:39 Elhorst_Panel_Code\direct_indirect_effects_estimates.m
文件 1111 2011-09-06 20:31 Elhorst_Panel_Code\f2_resar.m
文件 1320 2010-01-14 09:18 Elhorst_Panel_Code\f2_respat.m
文件 933 2010-01-14 09:18 Elhorst_Panel_Code\f2_sar2_panel.m
文件 1832 2010-10-15 08:30 Elhorst_Panel_Code\f2_sarpanel.m
文件 380 2010-04-26 06:11 Elhorst_Panel_Code\f2_sarpar2.m
文件 319 2010-04-26 06:22 Elhorst_Panel_Code\f2_sarpaul.m
文件 1881 2010-10-15 08:30 Elhorst_Panel_Code\f2_sempanel.m
文件 1190 2010-01-14 09:18 Elhorst_Panel_Code\f2_serialspat.m
文件 782 2010-01-14 09:18 Elhorst_Panel_Code\f_resar.m
文件 1242 2010-01-14 09:18 Elhorst_Panel_Code\f_respat.m
文件 847 2011-06-05 13:34 Elhorst_Panel_Code\f_sar2_panel.m
文件 1915 2010-10-15 08:30 Elhorst_Panel_Code\f_sarpanel.m
文件 275 2010-04-26 06:11 Elhorst_Panel_Code\f_sarpar2.m
文件 196 2010-04-26 06:11 Elhorst_Panel_Code\f_sarpaul.m
文件 1763 2010-10-15 08:30 Elhorst_Panel_Code\f_sempanel.m
文件 1175 2010-01-14 09:18 Elhorst_Panel_Code\f_serialspat.m
文件 1253 2010-01-14 09:18 Elhorst_Panel_Code\hessian.m
............此处省略32个文件信息
- 上一篇:移动目标检测MATLAB版
- 下一篇:TDPlanning2.3
相关资源
- 移动目标检测MATLAB版
- matlab贝叶斯分类(3)-UCI数据集通用分
- 几种现代谱估计的方法Matlab程序
- 分数延迟FIR滤波器Matlab程序
- SC-FDMA matlab
- 计算电磁学王秉中矩形波导基膜和第
- 并网仿真模型matlab
- AGC 自动增益控制 含matlab和c两种
- 用双线性变换法设计一个巴特沃斯低
- 基于Matlab的DMC算法仿真研究
- 单纯形算法的matlab实现
- 牛顿法,阻尼牛顿法和改进的阻尼牛
- 用于实现图像去雾的代码,很有效,
- 模拟ECG心电信号数据matlab
- 灰度形态学处理matlab代码
- matlab MK检验代码
- matlab生成地球格点面积mask
- 微电网负荷预测matlab源代码
- SimpleCalculator
- 超宽带信号发送、传输、接收的matl
- 数字图像处理第二版MatLab代码大全
- 用BP人工神经网络预测人口代码matla
- MATLAB模拟篮球比赛常规赛、季后赛对
- 基于MATLAB的阵列信号处理仿真方法
- MATLAB Code.rar.rar
- 脉冲雷达测速测距的matlab程序.rar
- 基于SVM(支持向量机) 的人脸识别
- VMD分解变分模态分解
- 粒子群优化算法演示及matlab源程序
- 禁忌算法matlab源程序
评论
共有 条评论