-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
According to the logic, and also documentation, the model = 2 shouldn't require data present in all years. For example, the vignette "rtrim by example" says:
The advantage of Model 3 is, as argued above, the absence of any assumptions regarding the temporal trend. This, however, comes at a price: Postive counts are required for all individual years to allow estimation of the model parameters. So, this model cannot be used for cases where one or more years are missing.
implying the model 2 shouldn't require all years present. But it does. The following code ends with an error:
x <- structure(list(Ad1 = c(2L, 6L, 7L, 7L, 5L, 4L, 6L, 9L, 11L, 4L,
5L, 7L, 5L, 11L, 6L, 5L, 11L, 14L, 10L, 11L, 11L, 13L, 11L, 10L,
8L, 4L, 3L, 2L, 6L, 2L, 4L, 4L, 5L, 4L, 47L, 37L, 32L, 22L, 21L,
16L, 17L, 10L, 21L, 17L, 29L, 35L, 19L, 19L, 15L, 16L, 11L, 10L,
14L, 9L, 12L, 15L, 17L, 12L, 16L, 13L, 6L, 17L, 8L, 11L, 9L,
15L, 13L, 10L, 9L, 7L, 11L, 11L, 7L, 5L, 11L, 9L, 6L, 10L, 7L,
10L, 13L, 8L, 5L, 14L, 16L, 8L, 15L, 10L, 3L, 8L, 9L, 4L, 3L,
2L, 3L, 7L, 5L, 3L, 3L, 2L, 9L, 8L, 7L, 8L, 7L, 10L, 10L, 4L,
5L, 5L, 7L, 12L, 7L, 3L, 2L, 6L, 7L, 11L, 6L, 6L, 3L, 5L, 6L,
6L, 7L, 6L, 4L, 4L, 1L, 2L, 5L, 4L, 1L, 1L, 2L, 3L, 1L, 10L,
3L, 9L, 11L, 13L, 11L, 3L, 7L, 8L, 7L, 12L, 6L, 6L, 4L, 8L, 4L,
12L, 14L, 18L, 12L, 9L, 8L, 8L, 11L, 14L, 8L, 19L, 10L, 12L,
13L, 8L, 5L, 16L, 13L, 19L, 12L, 6L, 9L, 8L, 10L, 5L, 11L, 4L,
15L, 5L, 7L, 14L, 8L, 17L, 13L, 17L, 5L, 5L, 12L, 2L, 11L, 8L,
10L, 5L, 3L, 16L, 14L, 10L, 16L, 7L, 12L, 6L, 23L, 7L, 6L, 9L,
8L, 9L, 10L, 6L, 7L, 4L, 2L, 2L, 5L), Site = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L), levels = c("351",
"632", "647", "660", "661", "664", "672", "673", "674", "676",
"677", "684", "697", "707", "743"), class = "factor"), Year = c(1997L,
1999L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L,
2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 1992L, 1993L, 1994L,
1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 1992L, 1993L, 1994L,
1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 1994L, 1995L, 1996L,
1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2004L, 2005L, 2006L,
2007L, 2008L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L,
2001L, 2002L, 2004L, 2005L, 2006L, 2008L, 1994L, 1995L, 1996L,
1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2004L, 2005L, 2006L,
2007L, 2008L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L,
2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L,
1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L,
2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 1994L, 1995L,
1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2003L, 2004L,
2005L, 2006L, 2007L, 2008L, 2009L, 1994L, 1995L, 1996L, 1998L,
2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L,
2009L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L,
2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 1994L,
1995L, 1996L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L, 2004L,
2005L, 2006L, 2008L, 1997L, 1998L, 1999L, 2000L, 2001L, 2002L,
2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L,
2012L, 2013L, 2014L, 2015L, 2017L, 2018L, 2000L, 2001L, 2002L,
2003L, 2004L, 2005L, 2006L, 2008L, 2009L, 2010L, 2011L, 2012L,
2013L, 2014L, 2015L, 2017L, 2018L, 2005L, 2006L, 2007L, 2008L,
2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2017L, 2018L
)), class = "data.frame", row.names = c(NA, -217L))
library(rtrim)
t1 <- trim(Ad1 ~ Site + Year, x, model = 2, overdisp = TRUE, serialcor = TRUE, max_iter = 1000)
Ends with an error:
Error in trim_workhorse(count, site, year, month, weights, covars, model, :
Years don't have a constant interval
and that is because year 2016 is missing (see sort(unique(m1$Year))).
Metadata
Metadata
Assignees
Labels
No labels