I would like to test differences in mean values of a Climate_variable between 4 different climatic Scenarios that are projected for many (3000) surveyed Sites for which I know the coordinates (Lon and Lat). My database is structured as follows:
Climate_variable | Scenario | Site | Lon | Lat |
---|---|---|---|---|
0.85 | A | S1 | 19.37 | 41.85 |
1.13 | B | S1 | 19.37 | 41.85 |
1.55 | C | S1 | 19.37 | 41.85 |
2.12 | D | S1 | 19.37 | 41.85 |
0.74 | A | S2 | 21.42 | 40.36 |
1.08 | B | S2 | 21.42 | 40.36 |
1.44 | C | S2 | 21.42 | 40.36 |
2.01 | D | S2 | 21.42 | 40.36 |
Because I have 4 observations for each Site but I am not interested in this effect, I wanted to go for a Linear Mixed Model with Site as random effect. However, climatic variables are often highly spatially autocorrelated so I also wanted to add a spatial autocorrelation structure using the coordinates of the sites.
This is the code I run using the nlme package on R:
mod <- lme(Climate_variable ~ Scenario,
correlation = corExp(form = ~Lon+Lat),
random = list(~1|Site))
However, there is an error message saying cannot have zero distances in "corSpatial", I guess because I have 4 observation with the same coordinates for each site.
So I tried this instead:
mod <- lme(Climate_variable ~ Scenario,
correlation = corExp(form = ~Lon+Lat | Scenario),
random = list(~1|Site))
But I get another error message: incompatible formulas for groups in 'random' and 'correlation'
How could I account for both the spatial autocorrelation and the non-independance of the observations for different Scenarios on the same Site?