Skip to contents

Calculates:

  • AIP: Atherogenic Index of Plasma = log10(TG / HDL_c)

  • CRI_I: Castelli Risk Index I = TC / HDL_c

  • CRI_II: Castelli Risk Index II = LDL_c / HDL_c

Usage

atherogenic_indices(
  data,
  col_map = NULL,
  na_action = c("keep", "omit", "error"),
  normalize = c("none", "log10"),
  verbose = TRUE
)

Arguments

data

data.frame/tibble with lipid columns.

col_map

named list mapping keys to columns, e.g. list(TG="TG", HDL_c="HDL_c", TC="TC", LDL_c="LDL_c").

na_action

one of c("keep","omit","error").

normalize

one of c("none","log10"). Reserved; AIP always uses log10(TG/HDL_c).

verbose

Logical; if TRUE (default), prints column mapping, the list of indices being computed, and a per-column results summary.

Value

tibble with columns AIP, CRI_I, CRI_II. If an ID column is detected in data (e.g. id, IID, participant_id), it is prepended.

Details

Behavior:

  • Required keys: TG, HDL_c. Optional: TC, LDL_c.

  • NA policy via na_action: "keep" (default), "omit" (drop rows with any NA in used lipids), "error".

  • Extreme screening via check_extreme and extreme_action ("warn","cap","error","ignore","NA"). Default bounds (mg/dL) used only for screening: TG (0, 10000), HDL_c (0, 1000), LDL_c (0, 10000), TC (0, 10000). Note: All indices are unitless ratios; units cancel in computations.

  • Emits progress via hm_inform() when verbose = TRUE or when package option enables logs.

References

Dobiášová M (2004). “Atherogenic Index of Plasma (AIP) log(Triglycerides/HDL-Cholesterol): Theoretical and Practical Implications.” Clinical Chemistry, 50(7), 1113–1115. doi:10.1373/clinchem.2004.033175 . Castelli WP, Doyle JT, Gordon T, et al. (1977). “High-Density Lipoprotein Cholesterol and Other Lipids in Coronary Heart Disease: The Framingham Study.” American Journal of Medicine, 62(5), 707–714. doi:10.1016/0002-9343(77)90874-9 .

Examples

df <- tibble::tibble(
  TG = c(150, 200),
  HDL_c = c(50, 40),
  TC = c(200, 220),
  LDL_c = c(120, 150)
)
cm <- list(TG = "TG", HDL_c = "HDL_c", TC = "TC", LDL_c = "LDL_c")
atherogenic_indices(df, col_map = cm)
#> atherogenic_indices(): reading input 'df' — 2 rows × 4 variables
#> atherogenic_indices(): col_map (4 columns — 4 specified)
#>   TG                ->  'TG'
#>   HDL_c             ->  'HDL_c'
#>   TC                ->  'TC'
#>   LDL_c             ->  'LDL_c'
#> atherogenic_indices(): computing markers:
#>   AIP        [log10(TG / HDL_c)]
#>   CRI_I      [TC / HDL_c [if TC available]]
#>   CRI_II     [LDL_c / HDL_c [if LDL_c available]]
#> atherogenic_indices(): results: AIP 2/2, CRI_I 2/2, CRI_II 2/2
#> # A tibble: 2 × 3
#>     AIP CRI_I CRI_II
#>   <dbl> <dbl>  <dbl>
#> 1 0.477   4     2.4 
#> 2 0.699   5.5   3.75