diff --git a/DESCRIPTION b/DESCRIPTION index 06e83453..8e817594 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,7 +42,6 @@ Suggests: knitr, markdown, testthat (>= 3.0.0), - MASS, ciTools VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/vignettes/incidence2.Rmd b/vignettes/incidence2.Rmd index 2e96e234..1c5b8ed7 100644 --- a/vignettes/incidence2.Rmd +++ b/vignettes/incidence2.Rmd @@ -9,7 +9,7 @@ vignette: > %\VignetteIndexEntry{An introduction to incidence2} %\VignetteEngine{knitr::knitr} %\VignetteEncoding{UTF-8} - %\VignetteDepends{outbreaks, ggplot2, MASS, ciTools, tidyr} + %\VignetteDepends{outbreaks, ggplot2, ciTools, tidyr} --- ```{r, include = FALSE} @@ -545,18 +545,23 @@ When called on incidence2 objects, these methods will utilise the underlying grouping structure without the user needing to explicitly state what it is. This makes it very easy to utilise in analysis pipelines. -#### Example fitting a negative binomial model +#### Example fitting a poisson model ```{r} # first twenty weeks of the ebola data set across hospitals dat <- incidence_(ebola, date_of_onset, groups = hospital, interval = "isoweek") dat <- keep_first(dat, 20L) -# fit a negative binomial to the grouped data +# fit a poisson model to the grouped data (fitted <- dat |> nest(.key = "data") |> - mutate(model = lapply(data, \(x) MASS::glm.nb(count ~ date_index, x)))) + mutate( + model = lapply( + data, + function(x) glm(count ~ date_index, data = x, family = poisson) + ) + )) # Add confidence intervals to the result (intervals <- fitted |>