【实例简介】地理加权回归(GWR)matlab代码,亲测可用,该代码利用matlab实现了地理加权回归的代码,内附实际算例。
【实例截图】
【核心代码】
function result = gwr(y,x,east,north,info);
% PURPOSE: compute geographically weighted regression
%----------------------------------------------------
% USAGE: results = gwr(y,x,east,north,info)
% where: y = dependent variable vector
% x = explanatory variable matrix
% east = x-coordinates in space
% north = y-coordinates in space
% info = a structure variable with fields:
% info.bwidth = scalar bandwidth to use or zero
% for cross-validation estimation (default)
% info.bmin = minimum bandwidth to use in CV search
% info.bmax = maximum bandwidth to use in CV search
% defaults: bmin = 0.1, bmax = 20
% info.dtype = 'gaussian' for Gaussian weighting (default)
% = 'exponential' for exponential weighting
% = 'tricube' for tri-cube weighting
% info.q = q-nearest neighbors to use for tri-cube weights
% (default: CV estimated)
% info.qmin = minimum # of neighbors to use in CV search
% info.qmax = maximum # of neighbors to use in CV search
% defaults: qmin = nvar 2, qmax = 4*nvar
% ---------------------------------------------------
% NOTE: res = gwr(y,x,east,north) does CV estimation of bandwidth
% ---------------------------------------------------
% RETURNS: a results structure
% results.meth = 'gwr'
% results.beta = bhat matrix (nobs x nvar)
% results.tstat = t-stats matrix (nobs x nvar)
% results.