| cbpp | R Documentation |
Contagious bovine pleuropneumonia (CBPP) is a major disease of cattle in Africa, caused by a mycoplasma. This dataset describes the serological incidence of CBPP in zebu cattle during a follow-up survey implemented in 15 commercial herds located in the Boji district of Ethiopia. The goal of the survey was to study the within-herd spread of CBPP in newly infected herds. Blood samples were quarterly collected from all animals of these herds to determine their CBPP status. These data were used to compute the serological incidence of CBPP (new cases occurring during a given time period). Some data are missing (lost to follow-up).
There are two datasets, although their precise origins are unclear.
The dataset used in the classical lme4 examples, cbpp,
matches the file maintained by the package authors. The extended
dataset, cbpp2, corresponds to Table 1 of
\insertCitelesnoff2004withinlme4, with the exception of herd 6,
which is a known typographical error in the original paper.
cbpp is a data frame with 56 observations on the following 4
variables.
herdA factor identifying the herd (1 to 15).
incidenceThe number of new serological cases for a given herd and time period.
sizeA numeric vector describing herd size at the beginning of a given time period.
periodA factor with levels 1 to 4.
The extended version, cbpp2, has the additional variables:
herdA factor identifying the herd (1 to 15).
treatmentA factor referring to the control measure used to manage CBPP.
Complete = complete isolation or antibiotic treatment,
Partial/null = partial/null isolation and no antibiotic
treatment,
Unknown = strategy remained.
avg_sizeThe average number of animals housed in a della (a temporary paddock used for holding cattle on the farm).
Serological status was determined using a competitive enzyme-linked immuno-sorbent assay (cELISA).
lesnoff2004withinlme4
lesnoff2004withinlme4
## response as a matrix
(m1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
family = binomial, data = cbpp))
## response as a vector of probabilities and usage of argument "weights"
m1p <- glmer(incidence / size ~ period + (1 | herd), weights = size,
family = binomial, data = cbpp)
## Confirm that these are equivalent:
stopifnot(all.equal(fixef(m1), fixef(m1p), tolerance = 1e-5),
all.equal(ranef(m1), ranef(m1p), tolerance = 1e-5))
## GLMM with individual-level variability (accounting for overdispersion)
cbpp$obs <- 1:nrow(cbpp)
(m2 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd) + (1|obs),
family = binomial, data = cbpp))
## Fitting the model for cbpp2
gm1 <- glmer(incidence/size ~ period + treatment + avg_size + (1 | herd),
family = binomial,
data = cbpp2, weights = size,
control = glmerControl(optimizer="bobyqa"))
## Adding an observation-level random effect
cbpp2 <- transform(cbpp2,obs=factor(seq(nrow(cbpp2))))
## Herd and observation-level REs (below causes singular fit issues)
gm2 <- update(gm1,.~.+(1|obs))
## observation-level REs only (no singular fit issue)
gm3 <- update(gm1,.~.-(1|herd)+(1|obs))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.