Skip to contents

This function calculates the estimated glomerular filtration rate (GFR) according to Finlay's formula, where serum creatine is in mg/dL. The calculation takes into account the respondent's ethnicity, sex, and age.

Usage

calculate_GFR(LAB_BCRE, PGDCGT, CLC_SEX, CLC_AGE)

Arguments

LAB_BCRE

numeric Blood creatine (µmol/L). It should be a numeric between 14 and 785.

PGDCGT

integer Ethnicity (13 categories). It should be an integer between 1 and 13.

CLC_SEX

integer Sex (Male = 1, Female = 2). It should be an integer of either 1 or 2.

CLC_AGE

numeric Age (years). It should be a numeric between 3 and 79.

Value

numeric The calculated GFR. If inputs are invalid or out of bounds, the function returns a tagged NA.

Details

This function implements the Modification of Diet in Renal Disease (MDRD) equation to estimate glomerular filtration rate, a key indicator of kidney function.

     **Clinical Significance:**
     GFR estimates are essential for:
     - Chronic kidney disease (CKD) classification
     - Medication dosing adjustments
     - Cardiovascular risk assessment

     **Formula Application:**
     Base: GFR = 175 × (creatinine^-1.154) × (age^-0.203)
     Adjustments:
     - Female: × 0.742
     - Black ethnicity: × 1.210

     **Unit Conversion:**
     Serum creatinine converted from µmol/L to mg/dL88.4)

     **Missing Data Codes:**
     - `LAB_BCRE`: `9996` (Not applicable), `9997-9999` (Missing)
     - `PGDCGT`: `96` (Not applicable), `97-99` (Missing)
     - `CLC_SEX`: `6` (Not applicable), `7-9` (Missing)
     - `CLC_AGE`: `96` (Not applicable), `97-99` (Missing)

See also

categorize_GFR_to_CKD() for CKD classification based on GFR values

Examples

# Scalar usage: Single respondent
# Example 1: Calculate GFR for a 45-year-old white female with serum creatine of 80 µmol/L.
calculate_GFR(LAB_BCRE = 80, PGDCGT = 1, CLC_SEX = 2, CLC_AGE = 45)
#> [1] 67.27905
# Output: 67.27905

# Example 2: Respondent has non-response values for all inputs.
result <- calculate_GFR(LAB_BCRE = 9998, PGDCGT = 98, CLC_SEX = 8, CLC_AGE = 98)
result # Shows: NA
#> [1] NA
haven::is_tagged_na(result, "b") # Shows: TRUE (confirms it's tagged NA(b))
#> [1] TRUE
format(result, tag = TRUE) # Shows: "NA(b)" (displays the tag)
#> [1] "NA"

# Multiple respondents
calculate_GFR(
  LAB_BCRE = c(80, 70, 90), PGDCGT = c(1, 2, 1),
  CLC_SEX = c(2, 2, 1), CLC_AGE = c(45, 35, 50)
)
#> [1] 67.27905 99.94114 77.47422
# Returns: c(67.27905, 99.94114, 70.38001)

# Database usage: Applied to survey datasets
library(dplyr)
# dataset %>%
#   mutate(gfr = calculate_GFR(LAB_BCRE, PGDCGT, CLC_SEX, CLC_AGE))