This 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)

Arguments

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 nots_ew.

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 NULL. If specified, then an average of the percentage decrease for a set number of years is taken. This is specified with years_to_avg.

years_to_avg

Numeric, the number of years over which to average the percentage decrease when estimating the ongoing percentage decrease.

Value

A nested tibble, containing the sample number, and both a nested dataframe and nested matrix of annual percentage changes.

See also

sample_per_decrease

Examples

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