I am exploring the use of GWmodel to run some GWR regressions. I set it up and tried to run some sample regressions using the gwr.basic function, but ran into the following error,
Error in t(X * W.i) : dims [product 4659] do not match the length of object [0]
This is what I did,
gwr.basic(Y~X+I(X^2), data = spdf,bw = bw.gwr.1, kernel = "gausssian", adaptive = TRUE, F123.test = TRUE)
And here is the summary of my input data set, spdf
**summary(spdf)
Object of class SpatialPointsDataFrame
Coordinates:
min max
Long 95.71586 103.70657
Lat 40.12491 42.89963
Is projected: NA
proj4string : [NA]
Number of points: 1553
Data attributes:
Y X
Min. : 51.33 Min. :100
1st Qu.:196.19 1st Qu.:115
Median :224.74 Median :123
Mean :216.66 Mean :123
3rd Qu.:245.70 3rd Qu.:131
Max. :346.72 Max. :150**
What may be happening?
Best Answer
I believe that you need to set the argument "longlat=TRUE". Since your data is in geographic coordinates it is likely that the kernel is being incorrectly defined. You also may want to explicitly specify the data slot "data = spdf@data".
Please use caution with specification of the GWR method in anything other than exploratory analysis of nonstationarity. It is a somewhat suspect method and there are a number of papers that indicate the incorrectness of this method in both type I & II error and severe bias in coefficients. That said, it can be a great exploratory tool, just not an inferential one.