moran_d.m
来自「计量工具箱」· M 代码 · 共 38 行
M
38 行
% PURPOSE: An example of using moran()
% to test for spatial error correlation
% on a small data set
%---------------------------------------------------
% USAGE: moran_d
%---------------------------------------------------
load anselin.dat;
y = anselin(:,1);
n = length(y);
x = [ones(n,1) anselin(:,2:3)];
xc = anselin(:,4);
yc = anselin(:,5);
[j W j] = xy2cont(xc,yc);
result = moran(y,x,W);
prt(result);
% demo non-standardized weight matrix
Wns = zeros(n,n);
for i=1:n
for j=1:n
if W(i,j) ~= 0
Wns(i,j) = 1.0;
end;
end;
end;
result = moran(y,x,Wns);
prt(result);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?