0

I am running a GWR model from the library spgwr, in R, and when I try to see the significant variables by using the function LMZ.F3GWR.test() I get the following error:

Error in solve.default(t(x) %*% diag(wj) %*% x) : system is computationally singular: reciprocal condition number = 6.21142e-21

Apparently, there is nothing wrong with the assumption on my data, there is no collinearity, all variables are scaled and no missing data. I am really lost about what is going on.

My data consists of Brazilian mortality rates as a response variable and continous data as predictors. My code for the GWR model is:

df_mun_spatial = as(DATA, "Spatial")

bw <- gwr.sel(alias(modelo)$Model,
             data=df_mun_spatial, adapt = TRUE, gweight = gwr.bisquare) 


gwr.model = gwr(alias(modelo)$Model,
                data = df_mun_spatial,
                adapt=bw,
                gweight = gwr.Gauss,
                hatmatrix=TRUE,
                se.fit=TRUE) 

And I get no errors at all. Is there a way to avoid this and use the function to get the p-values of statistically significant variables?

ElMago
  • 11
  • 3
  • The error indicates that the the matrix obtained from `t(x) %*% diag(wj) %*% x` is a singular matrix. You cannot invert a singular matrix. Though The matrix might not be singular, but computationaly its singular. – Onyambu Jul 24 '23 at 01:01
  • So it means the GWR model isn't appropiate in this case? Everything works except on returning the p-values for this specific function LMZ.F3GWR.test(). ps: After I changed the weitgh to be Bisquare instead of Gaussian it seemed to work after several minutes, returning the p-values that i wanted. – ElMago Jul 24 '23 at 01:21

0 Answers0