Learn R Programming

gwrr (version 0.2-2)

gwr.bw.est: Cross-validation estimation of kernel bandwidth

Description

Estimate the kernel function bandwidth with cross-validation

Usage

gwr.bw.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

Value

A list with the following items:

phi

Kernel bandwidth

RMSPE

Root mean squared prediction error from bandwidth estimation

cv.score

Sum of squared prediction errors from bandwidth estimation

Details

This function estimates the kernel bandwidth in a GWR model with leave-one-out cross-validation. It does not estimate the final regression coefficients or outcome variable.

References

Wheeler DC (2007) Diagnostic tools and a remedial method for collinearity in geographically weighted regression. Environment and Planning A, 39: 2464-2481

See Also

gwr.est

Examples

Run this code
# NOT RUN {
data(columbus)
locs <- cbind(columbus$x, columbus$y)
col.bw <- gwr.bw.est(crime ~ income + houseval, locs, columbus, "exp")
col.gwr <- gwr.est(crime ~ income + houseval, locs, columbus, "exp", bw=col.bw$phi)
# }

Run the code above in your browser using DataLab