title: How to account for spatial autocorrelation in a mixed effects model with time series data?
body: <p>I have a time series dataset of the amount of forest loss and the mean monsoon temperature and precipitation in 590 districts in a country. The format being a value for forest loss in kilometres, a value for temperature in Celsius and a value for precipitation in mm for each datapoint (district) for each year between 2000-2018.</p>
  
  <p>There is spatial autocorrelation in the data which has been identified using a variogram and Moran's I.</p>
  
  <p>The problem is I tried to run a lme model, with a random effect of the State that district is within:</p>
  
  <pre><code>mod.cor&lt;-lme(FLkm ~ Monsoon.Precip +
   Monsoon.Temp,correlation=corGaus(form=~x+y,nugget=TRUE),
   data=NE1, random = ~1|State)
  </code></pre>
  
  <p>And it gives me the error: </p>
  
  <blockquote>
    <p>Error in getCovariate.corSpatial(object, data = data) : cannot have
    zero distances in "corSpatial"</p>
  </blockquote>
  
  <p>I have looked up whether I can add correlation structures to models with time series data and it seems it may be possible with other methods such as Ordinary Least Squares, Geographically Weighted Regression or spatial autoregressive lag methods but I cannot find out more than this.</p>
  
  <p>Has anyone been able to model data like this while accounting for spatial autocorrelation and how did you do it?</p>