I want to check the results of my lme
-model for temporal autocorrelation. The data can be downloaded here (password: Variogram_2023). It contains the sampling date, group and extracted residuals from the model (E1). These residuals derived from an irregularly spaced time series, where there are multiple observations from the same sampling date.
I tried to test for temporal autocorrelation using gstat::variogram
, where sampling date is first converted to julian date and then used as the x-coordinate, while the y-coordinate is the mean residual value. I have repeated this by group.
I'm not really sure how to interpret these results, or whether I've done this correctly, so any suggestions about how to go about this will be much appreciated.
df_vario <- df %>%
mutate(jday = julian(.$date, origin = min(.$date)) + 1,
jday = as.numeric(jday)) %>%
select(E1, jday, group) %>%
group_by(age_class) %>%
mutate(ones = mean(E1))
sp::coordinates(df_vario) <- c("jday", "ones")
v1 <- gstat::variogram(E1 ~ jday + ones,
data = df_vario[df_vario$group == "r1",]) %>%
mutate(group = "r1")
v2 <- gstat::variogram(E1 ~ jday + ones,
data = df_vario[df_vario$group == "r2",]) %>%
mutate(group = "r2")
v3 <- gstat::variogram(E1 ~ jday + ones,
data = df_vario[df_vario$group == "r3",]) %>%
mutate(group = "r3")
mrg <- rbind(v1, v2, v3)
mrg %>%
ggplot() +
geom_point(aes(x = dist, y = gamma)) +
geom_smooth(aes(x = dist, y = gamma),
se = FALSE,
method = "loess") +
facet_wrap(~group, scales = "free_y") +
labs(x = "Julian Day", y = "Semi-variogram")