📄 gwr_logitd.m
字号:
% PURPOSE: An example of using gwr_logit()
% Geographically weighted logit regression model
% (on a small data set)
%---------------------------------------------------
% USAGE: gwr_d
%---------------------------------------------------
clear all;
% load the Anselin data set
load anselin.dat;
y = anselin(:,1);
nobs = length(y);
x = [ones(nobs,1) anselin(:,2:3)];
[nobs nvar] = size(x);
north = anselin(:,4);
east = anselin(:,5);
% convert y's to 0,1 values
ymean = mean(y);
yzip = zeros(nobs,1);
ind = find(y > ymean);
yzip(ind,1) = 1;
vnames = strvcat('crime','constant','income','hvalue');
% y = dependent variable
% x = a matrix of indepdendent variables
% east holds x-coordinates
% north holds y-coordinates
% nobs = # of observations
% nvar = # of explanatory variables
info.dtype = 'gaussian'; % Gaussian distance weighting
tic; result1 = gwr_logit(yzip,x,east,north,info); toc;
prt(result1,vnames);
tt=1:nobs;
plot(tt,yzip,'+',tt,result1.yhat,'o');
title('actual vs predicted');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -