R/sample_annual_decrease_nots.R
sample_annual_decrease_nots.RdThis function samples the percentage annual decrease, using TB notifications.
The percentage annual change is first estimated using prop.test, along with the 95
intervals. Assuming that the percentage annual decrease is normally distributed multiple samples are then
taken. This is returned as a tibble, containing the nested dataframe and a nested matrix ready to be
used by sutherland_model.
sample_annual_decrease_nots(notifications = NULL, TB_cohorts = c("15-19 years", "20-24 years", "25-29 years"), samples = 100, max_year = NULL, years_to_avg = 3)
| notifications | A dataframe of notifications, it must contain a year variable, and the second variable
must be the number of notifications. If not specified defaults to |
|---|---|
| TB_cohorts | A character vector indicating the names of the cohorts modelled. Defaults to 15-19 years, 20-24 years, and 25-29 years. |
| samples | Numeric, the number of samples to take. Defaults to 100. |
| max_year | Numeric, set as greater than the maximum year in the dataframe if interested in projection.
Defaults to |
| years_to_avg | Numeric, the number of years over which to average the percentage decrease when estimating the ongoing percentage decrease. |
A nested tibble, containing the sample number, and both a nested dataframe and nested matrix of annual percentage changes.
sample_per_decrease
sample_annual_decrease_nots()#> # A tibble: 100 x 3 #> sample per_decrease_df per_decrease_mat #> <int> <list> <list> #> 1 1 <tibble [48 × 4]> <dbl [48 × 3]> #> 2 2 <tibble [48 × 4]> <dbl [48 × 3]> #> 3 3 <tibble [48 × 4]> <dbl [48 × 3]> #> 4 4 <tibble [48 × 4]> <dbl [48 × 3]> #> 5 5 <tibble [48 × 4]> <dbl [48 × 3]> #> 6 6 <tibble [48 × 4]> <dbl [48 × 3]> #> 7 7 <tibble [48 × 4]> <dbl [48 × 3]> #> 8 8 <tibble [48 × 4]> <dbl [48 × 3]> #> 9 9 <tibble [48 × 4]> <dbl [48 × 3]> #> 10 10 <tibble [48 × 4]> <dbl [48 × 3]> #> # … with 90 more rows