# [R-sig-ME] Modeling rates with unequally spaced census intervals

Phillip J van Mantgem pvanmantgem at usgs.gov
Fri Feb 15 20:38:24 CET 2008

```Dear R-sig-mixed-modelers:

I’m wondering how I would write a model to estimate changes in an average
rate among groups with unequally spaced census intervals.

I am interested in modeling changes in survivorship rates by calendar year,
where the census interval has an exponential effect on survival (i.e., p =
annual survival, and p^census interval).

# ---------------------------------------------------------------------
# An example, modifying the cbpp dataset provided in the lme4 package...

library(lme4)

cbpp2 <- cbpp

# treating the period as annual measurements
cbpp2\$equal.year <- as.numeric(cbpp\$period)

# unequally spaced measurements
cbpp2\$unequal.year <- c( c(1,3,7,10), c(1,5,10), rep(c(1,4,6,8), 5),
c(1), rep(c(1,3,7,10), 7))

m2 <- lmer(incidence / size ~ period + (1 | herd), weights = size,
family = binomial, data = cbpp2)

m3 <- lmer(incidence / size ~ equal.year + (1 | herd), weights = size,
family = binomial, data = cbpp2)

m4 <- lmer(incidence / size ~ unequal.year + (1 | herd), weights = size,
family = binomial, data = cbpp2)
# ---------------------------------------------------------------------

I don't think that the model specification for m4 is written so that I
could interpret the fixed effect for "unequal.year" as showing the average
annual change to the incidence rate. How would I do this?

Many thanks,
Phil

Phillip van Mantgem
USGS Western Ecological Research Center
Sequoia and Kings Canyon Field Station
47050 Generals Highway #4
Three Rivers, CA  93271-9651     USA
email: pvanmantgem at usgs.gov
```