Skip to content

Commit

Permalink
docs: change model in vignette to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
TimTaylor committed Aug 7, 2024
1 parent 8bcac13 commit e177876
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Suggests:
knitr,
markdown,
testthat (>= 3.0.0),
MASS,
ciTools
VignetteBuilder: knitr
Config/testthat/edition: 3
Expand Down
13 changes: 9 additions & 4 deletions vignettes/incidence2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 |>
Expand Down

0 comments on commit e177876

Please sign in to comment.