Skip to contents

Local weighted least squares \(\beta_i = (X'W_iX)^{-1}X'W_iy\) with \(C_i = (X'W_iX)^{-1}X'W_i\), hat matrix rows \(x_i'C_i\), \(\sigma^2 = RSS/(n - 2trS + trS'S)\), standard errors \(\sqrt{\sigma^2 diag(C_iC_i')}\), AICc, edf, enp and local R2 exactly as GWmodel::gwr.basic (Euclidean distances; Brunsdon, Fotheringham and Charlton 1996).

Usage

GWRBasic(y, X, coords, bw, kernel = "bisquare", adaptive = FALSE)

Arguments

y

Response.

X

Design matrix including any intercept column.

coords

Two-column matrix of coordinates.

bw

Bandwidth.

kernel

Kernel name.

adaptive

Adaptive bandwidth.

Value

List with betas, se, tvalues, fitted, residuals, local_r2, diagnostics.

References

Brunsdon, C., Fotheringham, A. S. and Charlton, M. E. (1996). Geographically weighted regression: a method for exploring spatial nonstationarity. Geographical Analysis 28, 281-298.

Fotheringham, A. S., Brunsdon, C. and Charlton, M. (2002). Geographically Weighted Regression. Wiley, Chichester.

Examples

P <- as.matrix(expand.grid(y = 0:3, x = 0:3)[, 2:1])
X <- cbind(1, (0.3 * (0:15)) %% 1.7)
y <- 1 + 2 * X[, 2] + 0.1 * P[, 1]
GWRBasic(y, X, P, 3, kernel = "gaussian")$diagnostics$AICc
#> [1] -20.82471