Skip to contents

A covariate drawn for each subject of mvp_population(), as on the app's "Covariate Distributions" tab.

Usage

mvp_covariate(
  dist = c("normal", "lognormal", "uniform", "binary"),
  mean = NULL,
  sd = NULL,
  gmean = NULL,
  gsd = NULL,
  min = NULL,
  max = NULL,
  percent = 50,
  values = c(1, 0)
)

Arguments

dist

"normal", "lognormal", "uniform" or "binary".

mean, sd

Normal: mean and standard deviation.

gmean, gsd

Log-normal: geometric mean (median) and geometric standard deviation (>= 1), on the normal scale, as in the app.

min, max

Uniform: limits.

percent, values

Binary: percentage of subjects (0-100) with values[1]; the others get values[2].

Value

An object of class mvp_covariate.

Details

Values are rounded to 2 decimals, as in the app. With the same seed, the first three covariates are the same as the app's covariates 1-3.

See also

Examples

pop <- mvp_population(50, db = "NHANES", seed = 1,
  covariates = list(CRCL = mvp_covariate("normal", mean = 110, sd = 20),
                    ALB  = mvp_covariate("lognormal", gmean = 40, gsd = 1.1),
                    JAPANESE = mvp_covariate("binary", percent = 30)))
summary(pop[c("CRCL", "ALB", "JAPANESE")])
#>       CRCL             ALB           JAPANESE  
#>  Min.   : 51.96   Min.   :34.28   Min.   :0.0  
#>  1st Qu.: 99.66   1st Qu.:38.41   1st Qu.:0.0  
#>  Median :115.47   Median :41.37   Median :0.0  
#>  Mean   :114.12   Mean   :40.66   Mean   :0.3  
#>  3rd Qu.:123.78   3rd Qu.:42.73   3rd Qu.:1.0  
#>  Max.   :163.14   Max.   :49.17   Max.   :1.0