Open TaylorOshan opened 2 years ago
Hi @TaylorOshan - thanks for the nudge. I will look into this in depth soon. I did have immediate conversations with co-authors about this at the time and we concluded that the effect of the error / omission (not square rooting the weight) would in effect result in the bi-square weighting tending towards but not reaching a box car weighting. But this needs further investigation and at some point potentially a clarification to the paper's results.
Hi @lexcomber, following up from our email conversation back in September, I was curious if any judgment was rendered concerning the potential bug and whether or not it has a substantial effect on the hyperlocal GWR routine. To refresh, it appears there is a bug in the code that makes the geographically weighted estimates from hyperlocal GWR inconsistent with what would be obtained using other geographically weighted regression software. I noticed that instead of using a weighted least squares estimator, the routine was actually applying the geographical weights directly to the data and then using that data in an ordinary least squares. I believe this will produce different results than the alternative of using the geographical weights within a weighted least squares estimator. Usually this can be remedied by taking the square root of the of the weights before applying them each to the dependent variable and independent variables (or in this case the entire data frame). However, I did try this and the results still did not quite match up with the canonical weighted least squares estimator. Through exploration, I was able to get them to match up and it seemed to be related to the intercept. If I add a column of ones to the dataframe before multiplying it by the weights and then include it as an independent variable in the
lm
call instead of using the default intercept, then the results are equivalent to the weighted least squares estimator - the formula ends up looking like:y ~ intercept + X1 + X2 -1
instead ofy ~ X1 + X2
. I'm not entirely clear why this would cause a difference, but I'm not an R aficionado, and perhaps something is going on under the hood or I've got something mixed up. In any event, it would look like a square root of the weights is needed, and possibly some other adjustments, which may impact some of the results in the paper.