gwl.est {gwrr} | R Documentation |
Geographically weighted lasso
Description
This function fits a geographically weighted lasso (GWL) model
Usage
gwl.est(form, locs, data, kernel = "exp", cv.tol)
Arguments
form |
A regression model forumula, as in the functions lm and glm |
locs |
A matrix of spatial coordinates of data points, where the x coordinate is first, then the y coordinate; coordinates are assumed to not be latitude and longitude, as Euclidean distance is calculated from coordinates |
data |
A data frame with data to fit model |
kernel |
A kernel weighting function, either exp or gauss, where exponential function is default |
cv.tol |
A stopping tolerance in terms of cross-validation error for the bi-section search routine to estimate the kernel bandwidth using cross-validation; if missing an internally calculated value is used |
Details
This function estimates penalized spatially varying coefficients using the geographically weighed regression and lasso approaches. Spatial kernel weights are applied to observations using the estimated kernel bandwidth to estimate local models at each data point. The kernel bandwidth and lasso solutions are currently estimated using cross-validation with an exponential or Gaussian kernel function. Some regression coefficients may be penalized to zero. The function estimates regression coefficients, the outcome variable values, and the model fit.
Value
A list with the following items:
phi |
Kernel bandwidth |
RMSPE |
Root mean squared prediction error from bandwidth estimation |
beta |
Matrix of estimated regression coefficients, where a row contains the coefficients for one regression term for all data points |
yhat |
Estimated outcome variable values |
RMSE |
Root mean squared error from estimation |
rsquare |
Approximate R-square for GWR model |
Author(s)
David Wheeler
References
Wheeler DC (2009) Simultaneous coefficient penalization and model selection in geographically weighted regression: The geographically weighted lasso. Environment and Planning A, 41: 722-742
See Also
Examples
data(columbus)
locs <- cbind(columbus$x, columbus$y)
col.gwl <- gwl.est(crime ~ income + houseval, locs, columbus, "exp")
plot(col.gwl$beta[2,], col.gwl$beta[3,])
plot(columbus$x, columbus$y, cex=col.gwl$beta[1,]/10)