Skip to content

Possible interface for simple fitting #2

@TimTaylor

Description

@TimTaylor
library(incidence2)
library(incidence2plus)
library(tidyr)

data(ebola_sim_clean, package = "outbreaks")
dat <- ebola_sim_clean$linelist

inci <- incidence(
  dat,
  date_index = date_of_onset,
  interval = "week",
  last_date = "2014-10-05",
  groups = gender
)
#> 3522 observations outside of [2014-04-07, 2014-10-05] were removed.
inci %>% 
  fit(model = "poisson")
#> # A tibble: 2 x 6
#>   gender model  fitted                 r `r-lower` `r-upper`
#>   <fct>  <list> <list>             <dbl>     <dbl>     <dbl>
#> 1 f      <glm>  <tibble [26 × 6]> 0.0249    0.0233    0.0265
#> 2 m      <glm>  <tibble [26 × 6]> 0.0250    0.0234    0.0267
inci %>% 
  fit(model = "poisson") %>% 
  add_doubling()
#> # A tibble: 2 x 9
#>   gender model fitted      r `r-lower` `r-upper` doubling `doubling-lower`
#>   <fct>  <lis> <list>  <dbl>     <dbl>     <dbl>    <dbl>            <dbl>
#> 1 f      <glm> <tibb… 0.0249    0.0233    0.0265     27.9             29.8
#> 2 m      <glm> <tibb… 0.0250    0.0234    0.0267     27.7             29.7
#> # … with 1 more variable: `doubling-upper` <dbl>
inci %>% 
  fit(model = "poisson") %>% 
  plot(color = "white", angle = 45, n_breaks = 4)

Created on 2020-09-03 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions