threemc_aggregate: Produce Population Weighted Aggregated Samples for All Area...

View source: R/aggregation.R

threemc_aggregateR Documentation

Produce Population Weighted Aggregated Samples for All Area Levels

Description

Aggregate by area, year, age and type (weighted by population), and convert to a percentage/probability.

Usage

threemc_aggregate(
  .data,
  fit,
  areas,
  populations,
  age_var = c("age", "age_group"),
  type = c("probability", "incidence", "prevalence"),
  area_lev,
  N = 100,
  prev_year = 2008,
  probs = c(0.025, 0.5, 0.975),
  ...
)

Arguments

.data

data.frame of unaggregated modelling results.

fit

TMB list containing model parameters, nested list of samples for the (cumulative) incidence and hazard rate of circumcision for the region(s) in question.

areas

sf shapefiles for specific country/region.

populations

data.frame containing populations for each region in tmb fits.

age_var

Determines whether you wish to aggregate by discrete ages or age groups (0-4, 5-9, 10-14, and so on).

type

Determines which aspect of MC in the regions in question you wish to aggregate for. Can be one of "probability", "incidence" or "prevalence".

area_lev

PSNU area level for specific country.

N

Number of samples to be generated, Default: 100

prev_year

If type == "prevalence", choose year to compare prevalence with.

probs

Percentiles to provide quantiles at. Set to NULL to skip computing quantiles.

...

Further arguments to internal functions.

Value

data.frame with samples aggregated by aggr_cols and weighted by population.


mrc-ide/threemc documentation built on Feb. 9, 2024, 5:16 p.m.