Skip to contents

Given fasting labs and anthropometry, computes:

  • SPISE (Single-Point Insulin Sensitivity Estimator)

  • METS_IR (Metabolic Score for Insulin Resistance)

  • prediabetes flag (HbA1c >= 42 mmol/mol)

  • diabetes flag (HbA1c >= 48 mmol/mol)

  • HOMA_CP (C-peptide-based HOMA-IR variant; operational formula, see notes)

  • LAR (Leptin/Adiponectin Ratio)

  • ASI (Adiponectin Sensitivity Index; adiponectin/insulin)

  • TyG_index (Triglyceride-Glucose Index)

Usage

glycemic_markers(
  data,
  col_map = NULL,
  na_action = c("ignore", "warn", "error", "keep", "omit"),
  na_warn_prop = 0.2,
  verbose = TRUE
)

Arguments

data

A data.frame or tibble containing at least:

  • HDL_c (mmol/L), TG (mmol/L), BMI (kg/m^2) Optional if present: glucose (mmol/L), HbA1c (mmol/mol), C_peptide (pmol/L), G0 (mmol/L), I0 (pmol/L), leptin (ng/mL), adiponectin (ng/mL).

col_map

Optional named list mapping keys to column names in data. Required keys: HDL_c, TG, BMI. Optional keys (if present will be used): glucose, HbA1c, C_peptide, G0, I0, leptin, adiponectin. If NULL (default), the function uses columns named exactly as the keys.

na_action

One of c("ignore","warn","error","keep","omit"). HM-CS aliases: keep == ignore; omit drops rows with any NA/non-finite in used inputs before computing markers. Default "ignore".

na_warn_prop

Proportion (0-1) threshold for high-missingness warnings among used columns when na_action = "warn". Default 0.2.

verbose

Logical; if TRUE (default), prints step-by-step progress including column mapping, optional input availability, pre-computation notes, physiological range information (informational only, values are not altered), the list of markers being computed with their inputs, and a per-column results summary.

Value

A tibble with columns:

  • SPISE, METS_IR, prediabetes, diabetes, HOMA_CP, LAR, ASI, TyG_index If an ID column is detected in data (e.g. id, IID, participant_id), it is prepended as the first output column.

Details

Assumed units (no automatic conversion of inputs except where noted):

  • HDL_c, TG: mmol/L (TyG internally converts TG to mg/dL via 88.57)

  • BMI: kg/m^2

  • glucose, G0: mmol/L (TyG internally converts glucose to mg/dL via 18)

  • HbA1c: mmol/mol

  • C_peptide, I0: pmol/L (HOMA_CP uses I-like conversion factor 6 as in insulin muU/mL; see notes)

  • leptin, adiponectin: ng/mL

These indices are intended for research and feature-engineering applications. The prediabetes and diabetes flags apply standard HbA1c cut-offs (WHO/IDF criteria) but this function is not validated as a clinical diagnostic tool.

Quality controls and options:

  • Input validation ensures required variables exist and are numeric-coercible.

  • Non-numeric inputs are coerced to numeric with a warning (NAs introduced reported).

  • Missing or non-finite inputs are handled via na_action.

  • Logs and divisions are computed safely (non-positive arguments yield NA).

  • Physiological range notes are printed when verbose = TRUE (values are not altered).

  • Verbose mode prints step-by-step progress and a completion summary.

Optional marker detection and pre-computation (one level deep): When col_map = NULL (default), column names are inferred automatically. The seven optional keys (glucose, HbA1c, C_peptide, G0, I0, leptin, adiponectin) are computed only when present in data. If BMI is absent but weight (kg) and height (m or cm) are present, BMI is computed automatically. If glucose is absent but G0 column exists (or vice versa), the missing key is derived via alias. With verbose = TRUE (default), the function reports: column mapping, what is missing and which raw inputs could provide it, which indices will be NA and why, any physiological range notes, and a per-column results summary.

Notes on HOMA_CP:

  • This function retains the package's existing operational formula: HOMA_CP = (G0 (mmol/L) * (C_peptide (pmol/L) / 6)) / 22.5 which mirrors HOMA-IR's structure using a 6 pmol/muU scaling used for insulin. Users should verify unit conventions for their datasets; alternative C-peptide HOMA implementations exist (e.g., HOMA2-CP).

References

Paulmichl K, Hatunic M, Höbaus C, et al. (2016). “Modification and Validation of the Triglyceride-to–HDL Cholesterol Ratio as a Surrogate of Insulin Sensitivity in White Juveniles and Adults without Diabetes Mellitus: The Single Point Insulin Sensitivity Estimator (SPISE).” Clinical Chemistry, 62(9), 1211–1219. doi:10.1373/clinchem.2016.257436 . Bello-Chavolla OY, Almeda-Valdes P, García-Sánchez A, et al. (2018). “METS-IR, a novel score to evaluate insulin sensitivity, is predictive of visceral adiposity and incident type 2 diabetes.” European Journal of Endocrinology, 178(5), 533–544. doi:10.1530/EJE-17-0883 . Frühbeck G, Catalan V, Rodríguez A, Ramón Sánchez-Recalde Á, Becerril S, Sánchez-González Á, Baena N, Valentí-Azcárate F, Burrell MA, Salvador J (2019). “Adiponectin-leptin Ratio is a Functional Biomarker of Adipose Tissue Inflammation.” Nutrients, 11(2), 454. doi:10.3390/nu11020454 . Matthews DR, Hosker JP, Rudenski AS, Naylor BA, Treacher DF, Turner RC (1985). “Homeostasis Model Assessment: Insulin Resistance and Beta-Cell Function from Fasting Plasma Glucose and Insulin Concentrations in Man.” Diabetologia, 28(7), 412–419. doi:10.1007/BF00280883 . Simental-Mendía LE, Rodríguez-Morán M, Guerrero-Romero F (2008). “The Product of Fasting Glucose and Triglycerides as Surrogate for Identifying Insulin Resistance.” Metabolic Syndrome and Related Disorders, 6(4), 299–304. doi:10.1089/met.2008.0034 . Furler SM, Gan SK, Poynten AM, Chisholm DJ, Campbell LV, Kriketos AD (2006). “Relationship of Adiponectin with Insulin Sensitivity in Humans, Independent of Lipid Availability.” Obesity, 14(2), 228–234. doi:10.1038/oby.2006.29 .

Examples

# Quick smoke-test
df <- data.frame(glucose = 5.6, HbA1c = 44, G0 = 5.5, I0 = 60,
                 HDL_c = 1.2, TG = 1.5, BMI = 24)
glycemic_markers(df, verbose = FALSE)
#> # A tibble: 1 × 8
#>   SPISE METS_IR prediabetes diabetes HOMA_CP   LAR   ASI TyG_index
#>   <dbl>   <dbl>       <int>    <int>   <dbl> <dbl> <dbl>     <dbl>
#> 1  8.14    335.           1        0      NA    NA    NA      8.81

# \donttest{
df <- tibble::tibble(
  HDL_c       = c(1.0, 1.3),
  TG          = c(1.3, 2.0),
  BMI         = c(24, 30),
  glucose     = c(5.6, 7.1),
  HbA1c       = c(44, 38),
  C_peptide   = c(300, 500),
  G0          = c(5.5, 6.2),
  I0          = c(60, 120),
  leptin      = c(10, 20),
  adiponectin = c(8, 5)
)
glycemic_markers(df)
#> glycemic_markers(): reading input 'df' — 2 rows × 10 variables
#> glycemic_markers(): col_map (10 columns — 10 inferred from data)
#>   HDL_c             ->  'HDL_c'    (inferred)
#>   TG                ->  'TG'    (inferred)
#>   BMI               ->  'BMI'    (inferred)
#>   HbA1c             ->  'HbA1c'    (inferred)
#>   C_peptide         ->  'C_peptide'    (inferred)
#>   G0                ->  'G0'    (inferred)
#>   I0                ->  'I0'    (inferred)
#>   leptin            ->  'leptin'    (inferred)
#>   adiponectin       ->  'adiponectin'    (inferred)
#>   glucose           ->  'glucose'    (inferred)
#> glycemic_markers(): optional inputs
#>   present:  glucose, HbA1c, C_peptide, G0, I0, leptin, adiponectin
#> glycemic_markers(): computing markers:
#>   SPISE           [HDL_c, TG, BMI]
#>   METS_IR         [glucose, TG, BMI, HDL_c]
#>   prediabetes     [HbA1c]
#>   diabetes        [HbA1c]
#>   HOMA_CP         [G0, C_peptide]
#>   LAR             [leptin, adiponectin]
#>   ASI             [adiponectin, I0]
#>   TyG_index       [TG, glucose]
#> glycemic_markers(): results: SPISE 2/2, METS_IR 1/2, prediabetes 2/2, diabetes 2/2, HOMA_CP 2/2, LAR 2/2, ASI 2/2, TyG_index 2/2
#> # A tibble: 2 × 8
#>   SPISE METS_IR prediabetes diabetes HOMA_CP   LAR    ASI TyG_index
#>   <dbl>   <dbl>       <int>    <int>   <dbl> <dbl>  <dbl>     <dbl>
#> 1  8.10     NA            1        0    12.2  1.25 0.133       8.67
#> 2  5.79    318.           0        0    23.0  4    0.0417      9.33
glycemic_markers(df, verbose = FALSE)
#> # A tibble: 2 × 8
#>   SPISE METS_IR prediabetes diabetes HOMA_CP   LAR    ASI TyG_index
#>   <dbl>   <dbl>       <int>    <int>   <dbl> <dbl>  <dbl>     <dbl>
#> 1  8.10     NA            1        0    12.2  1.25 0.133       8.67
#> 2  5.79    318.           0        0    23.0  4    0.0417      9.33
glycemic_markers(df, na_action = "omit", verbose = FALSE)
#> # A tibble: 2 × 8
#>   SPISE METS_IR prediabetes diabetes HOMA_CP   LAR    ASI TyG_index
#>   <dbl>   <dbl>       <int>    <int>   <dbl> <dbl>  <dbl>     <dbl>
#> 1  8.10     NA            1        0    12.2  1.25 0.133       8.67
#> 2  5.79    318.           0        0    23.0  4    0.0417      9.33
# }