I've attempted a geographically weighted regression but feel I might have performed some sought of stupidity. I am unable to harvest neither the coefficient size nor the standard error (I would like to calculate the t
statistic and p-value
).
library(sf)
library(sp)
#- read
col = st_read('./SpatialStats_CoCT_HusCrm.gpkg', layer='LatticeDataR')
#- interpolate NaN values
intp_col <- col
intp_col$CRIME <- na_interpolation(intp_col$CRIME, na.rm = FALSE)
intp_col$AVMEDINC <- na_interpolation(intp_col$AVMEDINC, na.rm = FALSE)
intp_col$GV2015VAL <- na_interpolation(intp_col$GV2015VAL, na.rm = FALSE)
#- adaptive
crime.bw03 <- gwr.sel(intp_col$CRIME ~ intp_col$AVMEDINC + intp_col$GV2015VAL,
data=intp_col, adapt = TRUE, # data=col,
coords = cbind(intp_col$X, intp_col$Y))
#- fit
gwr.fit3 <- gwr(intp_col$CRIME ~ intp_col$AVMEDINC + intp_col$GV2015VAL,
data = intp_col,
coords = cbind(intp_col$X, intp_col$Y),
adapt= crime.bw03, se.fit=T, hatmatrix=T)
Call:
gwr(formula = intp_col$CRIME ~ intp_col$AVMEDINC + intp_col$GV2015VAL,
data = intp_col, adapt = crime.bw03, hatmatrix = T, se.fit = T)
Kernel function: gwr.Gauss
Adaptive quantile: 0.00599 (about 4 of 777 data points)
Summary of GWR coefficient estimates at data points:
Min. 1st Qu. Median 3rd Qu. Max. Global
X.Intercept. -1.65e+03 4.24e+02 6.21e+02 8.85e+02 1.71e+03 582
intp_col.AVMEDINC -2.44e-02 -1.95e-04 2.40e-04 1.78e-03 2.31e-02 0
intp_col.GV2015VAL -4.21e-04 -1.36e-05 6.88e-07 2.48e-05 4.03e-04 0
Number of data points: 777
Effective number of parameters (residual: 2traceS - traceS'S): NA
Effective degrees of freedom (residual: 2traceS - traceS'S): NA
Sigma (residual: 2traceS - traceS'S): NA ...
Notice the zero
Global and NA
s.
I want to harvest the coeficients the standard error to calculate the t
and p
for an independent variable.
names(gwr.fit3$SDF)
[1] "sum.w" "X.Intercept."
[3] "intp_col.AVMEDINC" "intp_col.GV2015VAL"
[5] "X.Intercept._se" "intp_col.AVMEDINC_se"
[7] "intp_col.GV2015VAL_se" "gwr.e"
[9] "pred" "pred.se"
[11] "localR2" "X.Intercept._se_EDF"
[13] "intp_col.AVMEDINC_se_EDF" "intp_col.GV2015VAL_se_EDF"
[15] "pred.se.1
gwr.fit3$SDF$intp_col.GV2015VAL_se
NULL
Also if I attempt to execute a spgwr
significance test:
LMZ.F3GWR.test(gwr.fit3)
Error in solve.default(t(x) %*% diag(wj) %*% x) :
system is computationally singular: reciprocal condition number = 9.96923e-17
I don't know. The data is [-> here]. Your help is appreciated.