3

I am trying to perform a logistic regression with the following code

Y ~ x1+x2+x3,data=data, family=binomial(link="logit").

However on inspection of both the outcome and predictors i noticed that they are characterized by spatial auto-correlation. My question is, how do I account for the spatial auto-correlation, to get better coefficients?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Paulo
  • 31
  • 5
  • You should'nt call your data 'data', you wouldn't call your dog 'dog', would you? (sorry, shamelessly borrowed from an old S-help posting) – kjetil b halvorsen Sep 05 '17 at 22:05
  • 1
    There is a CRAN package `geoRglm`, try that? – kjetil b halvorsen Sep 05 '17 at 22:06
  • @kjetil If `R` did not generously recognize that the use of `data` here cannot possibly reference the built-in `data` function, there would be a problem. If, in order to write working code, people had to memorize the names of all objects in the base `R` environment so as to avoid re-using them, nobody would be using `R` today. So: in a program that utilizes just one dataset, just as in a world where there is only one dog, there seems to be no problem calling the dataset `data` or the dog "dog". Indeed, in doing so there's some relief from the need to invent yet another name. – whuber Sep 05 '17 at 22:19
  • The suggestion by @kjetil is a good one. However, since your predictors are spatially correlated, one of the first things to do is assess whether the *residuals* of your regression exhibit any important spatial correlation. If they do not, maybe you don't have to worry about this issue. – whuber Sep 05 '17 at 22:20

0 Answers0