I fitted a piecewise regression model for species counts, but for three species the model results are not accurate. Any ideas to fix this?
fit <- lapply(seq_along(X), function(x)
inla(Y ~ 1 + year000 + y2006 + y2011 + f(year1, model = "ar1"),
data = data.frame(Y = X[[x]]$Count, year1 = 1:15,
year000 = (year-2003)*(year<2006),
y2006 = (year-2006)*(year>=2006)*(2011>year),
y2011 = (year-2011)*(year>=2011)),
family = "poisson", control.family = list(link = "log"),
control.compute = list(dic = TRUE,cpo = TRUE, po = TRUE)))
Thanks in advance