1

I am trying to account for spatial autocorrelation using the gls function in the nlme package using the following code:

sp2 <- gls(final$formula, data = BITS_B, correlation = corLin(form = ~ Mid.Y + Mid.X, nugget = TRUE))

But I keep getting the error:

Error in getCovariate.corSpatial(object, data = data) : cannot have zero distances in "corSpatial"

I tried to add year as another group factor (since I had samples from 30 years):

sp2 <- gls(final$formula, data = BITS_B, correlation = corLin(form = ~ Mid.Y + Mid.X | Year, nugget = TRUE))

But the problem persists. Does anyone know what else I cand do? I am not sure I understand the nature of the issue. Thank you!

0 Answers0