estimate_age_mixing: Calculate age mixing structures

Description Usage Arguments Value Examples

Description

A function to estimate age mixing matrices for user-supplied data. Choose between different distributions around mean partner age (Normal or Gamma), and either an identity or log link for the Gamma distribution. See "Revisiting Assumptions about Age Preferences in Mathematical Models of Sexually Transmitted Infection" (Easterly, et al., 2018) for details about the estimation procedures. For a function to estimate the best mixing structure for your data, see best_age_mixing

Usage

1
2
3
estimate_age_mixing(choice_data, start_ages, distribution = c("gamma",
  "normal"), link = c("identity", "log"), max_age = 74,
  age_distribution = NULL)

Arguments

choice_data

a dataframe with chooser age, partner age, sex, and optional survey weights. These columns should be named chsage, ptage, sex, and weights, respectively. Sex must be coded as "Male" and "Female"

start_ages

vector of the youngest ages included in each age group. If start_ages is c(12, 20, 30), the age groups are 12-19, 20-29, and 30 to max_age - 1.

distribution

Provide the distribution of the errors around the mean partner age. Choose from "gamma" or "normal" distributions.

link

When "gamma" is chosen as the distribution, the link can be either "identity" or "log". If the distribution is "normal", this has no effect.

max_age

The non-inclusive right-hand endpoint of the oldest age group within the model population. Default is 74, so if the oldest age group begins at 60, the age interval is 60-73. Must be less than or equal to 100.

age_distribution

Optional: a vector of length length(seq(min(start_ages), max_age)), where the ith entry is the proportion of the model population with age i + min(start_ages) - 1 - that is, the first entry is min(start_ages), and the second entry is min(start_ages) + 1. This vector defines the proportion of the model population with every age, not age group. If not provided, the 2010-2012 U.K. life tables are used to estimate the population age distribution (see uk_life_table).

Value

A list, where MOME is the male age mixing matrix, FOME is the female age mixing matrix, AIC is the AIC of the estimated statistical model, and fits has information on the fit (can be used for sensitivity analysis).

Examples

1
2
3
4
5
data("mixage_sample_data")
agemix <- estimate_age_mixing(choice_data = mixage_sample_data, 
          start_ages = seq(12, 72, by = 2),
          max_age = 74)
 

caleb-easterly/mixage documentation built on May 12, 2019, 4:25 p.m.