0

I am using the GWmodel package in R to perform Geographically Weighted Regression. I have approximately 100 locations, for which I have calculated the distance matrix named DM using the function distm() of geosphere package.

Then I am using the bw.gwr() function as following :

gwr_band <-bw.gwr(no_cases~ .,data = train_data, approach = "CV", kernel = "bisquare", dMat=DM)

However, the function exits with the following error :

error: inv(): matrix is singular
Fixed bandwidth: 188594.1 CV score: Inf 

error: inv(): matrix is singular
Fixed bandwidth: 116580.9 CV score: Inf 
Error in while ((abs(d) > eps) && (abs(d1) > eps)) { : 
  missing value where TRUE/FALSE needed

I have tried changing some of the parameters of the function (kernel or setting longlat to TRUE), but I still get the same error. I use 120 predictor variables. However, when I use a subset of them (e.g. 5-10 variables), I don't get any error. Is there any limit to the number of predictor variables that the package supports?

1
  • If you data is in a geographic projection, reproject into a distance based projection. Jul 30 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.