get_scores: Calculate Scores for Children and Young Adults

View source: R/score_calculator.R

get_scoresR Documentation

Calculate Scores for Children and Young Adults

Description

Computes age-, sex- and (for 'sbp' and 'dbp') height-specific percentile ranks or z-scores for clinical biomarkers using IDEFICS study reference data and Biomarkers4Pediatrics collaboration (for 'crp').

Usage

get_scores(
  variable = "waist",
  sex = c("f", "m"),
  age = 6:5,
  height = NULL,
  values = c(20, 21),
  return_values = c("percentile", "z.score")
)

Arguments

variable

Character. The variable to assess. Must be one of the supported variables ("waist", "bmi", "hdl", "sbp", "dbp", "trg", "homa", "glu", "height","insu", or "crp").

sex

Character vector. Same length as 'age', 'height', and 'values'. Accepts "f" for female or "m" for male.

age

Numeric vector. Ages of the children/young adults in years. Must be between 1 and 22.5 for 'crp', and between 2 and 11 otherwise.

height

Numeric vector or NULL. Required for height-dependent models ('sbp' and 'dbp'). Defaults to NULL.

values

Numeric vector. Observed values of the variable to score. Values must be supplied in the units used by the corresponding reference model: 'waist' and 'height' in cm; 'bmi' in kg/m^2; 'sbp' and 'dbp' in mmHg; 'trg' and 'hdl' in mg/dL; 'glu' in mg/dL; 'insu' in \muIU/mL; 'homa' as dimensionless HOMA-IR; and 'crp' in mg/L.

return_values

Character vector. Specifies which outputs to return. Options include "percentile", "z.score".

Details

For triglycerides ('trg'), the original IDEFICS scoring procedure applies sex-specific percentile and z-score values at 45 mg/dL, corresponding to the lower measurement limit used in the IDEFICS study. These values are retained here to reproduce the original IDEFICS score calculation.

Value

A named list containing the requested scores. Each element is a numeric vector of the same length as 'values'.

Examples

get_scores(
  variable = "crp",
  sex = c("f","f"),
  age = c(3, 12),
  values = c(4, 0.5)
  )

get_scores(
  variable="dbp",
  sex=c("f","m"),
  age=c(5,5),
  height=c(120,110),
  values=c(70,60)
)

get_scores(
  variable = "trg",
  sex = c("f", "m"),
  age = c(5.8, 6.5),
  values = c(50, 48)  # mg/dL
)


pediatric.zcalc documentation built on Sept. 30, 2026, 5:13 p.m.