Samples subjects from one of the app's virtual patient databases (NHANES,
CDC or WHO growth data), or makes n subjects without covariates
(db = "None"), as on the app's Variability page.
Arguments
- n
Number of subjects.
- db
"None","NHANES","CDC"or"WHO". See nhanes.filtered, cdc.expand and who.expand.- age
Age range in years,
c(lower, upper). Bounds are inclusive and compared in months (age * 12), as in the app. Defaults: 18 to 65 years for NHANES (as in the app), the whole database for CDC and WHO.- wt
Weight range in kg.
- bmi
Body mass index range in kg/m^2.
- prop_male
Proportion of males (
SEX = 0), between 0 and 1.- seed
Random seed for the sampling. The random number state of the R session is left unchanged.
- covariates
Extra covariates drawn from distributions, as the app's "Covariate Distributions" tab: a named list of
mvp_covariate(), e.g.list(CRCL = mvp_covariate("normal", mean = 110, sd = 20)).- data, data_columns
Covariates sampled from a dataset's subjects, as the app's "Use dataset covariate distributions": a data frame with an
IDcolumn (one value per subject is used) and the columns to take. Sampled without replacement when the dataset has exactlynsubjects, otherwise with replacement. They replace database columns of the same name.
Value
A data frame with one row per subject: ID (1 to n) and, from a
database, SEX, AGEMO, AGE (years), WT (kg), HT (cm), BMI and
BSA (m^2), plus any extra covariates. Columns named as model parameters
replace those parameters in mvp_simulate() (e.g. WT, CRCL).