I'm trying to make a GAMM of this data using smoothers for each of the "high1, low1, ...etc" variables, but when I input the following code, I get this singularity problem:
Error in MEestimate(lmeSt, grps) : Singularity in backsolve at level 0, block 1
The code in question:
Zones <-c(NDVI$High1, NDVI$Low1, NDVI$High2,
NDVI$Low2, NDVI$High3, NDVI$Low3, NDVI$High4, NDVI$Low4)
Time <- rep(NDVI$Time, 8)
Season <- rep(NDVI$Season, 8)
ID <- factor(rep(c("1.High", "1.Low", "2.High", "2.Low", "3.High",
"3.Low", "4.High", "4.Low"), each = length(NDVI$Time)))
library(mgcv)
Change1 <- gamm(Zones ~ Season + ID +
s(Time, by = as.numeric(ID == “1.High”)) +
s(Time, by = as.numeric(ID == “1.Low”)) +
s(Time, by = as.numeric(ID == “2.High”)) +
s(Time, by = as.numeric(ID == “2.Low”)) +
s(Time, by = as.numeric(ID == “3.High”)) +
s(Time, by = as.numeric(ID == “3.Low”)) +
s(Time, by = as.numeric(ID == “4.High”)) +
s(Time, by = as.numeric(ID == “4.Low”)),
weights = varIdent(form =~1 | ID))