I'm running a geographically weighted regression (GWR) in R
using the spgwr
library. I know it's possible to retrieve the local coefficients and standard errors of each observation with gwr_fit$SDF
.
Now how do I use this info to determine which local coefficients are statistically significant so I can plot them on a map?
reproducible example
library(spgwr)
library(UScensus2000tract)
library(parallel)
# load data
data("oregon.tract")
# calculate Optimal kernel bandwidth
GWRbandwidth <- gwr.sel( log(med.age) ~ log(white) + log(black), data=oregon.tract, adapt=T)
# detect number of CPU cores to go parallel
no_cores <- detectCores() - 1 # Calculate the number of cores
cl <- makeCluster(no_cores)# Initiate cluster
# run GWR Model
gwr_fit <- gwr( log(med.age) ~ log(white) + log(black), data=oregon.tract, adapt= GWRbandwidth, hatmatrix=TRUE, se.fit=TRUE, cl=cl)
# return Sp object with coefficients and standard errors
df <- gwr_fit$SDF