gen_age_height_weight: Generate demographic parameters for a virtual population

View source: R/gen_age_height_weight.R

gen_age_height_weightR Documentation

Generate demographic parameters for a virtual population

Description

Generate gender, NHANES race/ethnicity category, ages, heights, and weights for a virtual population, based on NHANES data.

Usage

gen_age_height_weight(
  nsamp = NULL,
  gendernum = NULL,
  reths,
  weight_category,
  agelim_years,
  agelim_months,
  nhanes_mec_svy
)

Arguments

nsamp

The desired number of individuals in the virtual population. nsamp need not be provided if gendernum is provided.

gendernum

Optional: A named list giving the numbers of male and female individuals to include in the population, e.g. list(Male=100, Female=100). Default is NULL, meaning both males and females are included, in their proportions in the NHANES data. If both nsamp and gendernum are provided, they must agree (i.e., nsamp must be the sum of gendernum).

reths

Optional: a character vector giving the races/ethnicities to include in the population. Default is c('Mexican American','Other Hispanic','Non-Hispanic White','Non-Hispanic Black','Other'), to include all races and ethnicities in their proportions in the NHANES data. User-supplied vector must contain one or more of these strings.

weight_category

Optional: The weight categories to include in the population. Default is c('Underweight', 'Normal', 'Overweight', 'Obese'). User-supplied vector must contain one or more of these strings.

agelim_years

Optional: A two-element numeric vector giving the minimum and maximum ages (in years) to include in the population. Default is c(0,79). If agelim_years is provided and agelim_months is not, agelim_years will override the default value of agelim_months.

agelim_months

Optional: A two-element numeric vector giving the minimum and maximum ages (in months) to include in the population. Default is c(0, 959), equivalent to the default agelim_years. If agelim_months is provided and agelim_years is not, agelim_months will override the default values of agelim_years.

nhanes_mec_svy

surveydesign object created from mecdt using svydesign (this is done in httkpop_generate)

Details

This function should usually not be called directly by the user. It is used by httkpop_generate() in "virtual-individuals" mode.

Value

A data.table containing variables

gender

Gender of each virtual individual

reth

Race/ethnicity of each virtual individual

age_months

Age in months of each virtual individual

age_years

Age in years of each virtual individual

weight

Body weight in kg of each virtual individual

height

Height in cm of each virtual individual

Author(s)

Caroline Ring

References

\insertRef

ring2017identifyinghttk

importFrom survey svymean


httk documentation built on Sept. 11, 2024, 9:32 p.m.