Kidney Failure Risk Equation (KFRE, 2- and 5-year risk)
Source:R/kidney_kfre.R
kidney_failure_risk.RdCompute 2- and 5-year risk of end-stage kidney disease using the original 4-variable KFRE (Tangri et al., 2011) with optional data-quality diagnostics, and verbose progress reporting.
Arguments
- data
A data.frame or tibble containing at least the columns mapped in
col_map.- col_map
Named list mapping:
age-> age in yearssex-> sex code (1 = male, 2 = female)eGFR-> estimated GFR (mL/min/1.73 m^2)UACR-> urine albumin-to-creatinine ratio (mg/g)
- na_action
One of c("keep","error","omit","warn"). Default "keep" to preserve previous behavior:
"keep": propagate NA/NaN through logs and outputs.
"error": abort if any required input contains missing values.
"omit": drop rows with NA in required inputs before computation.
"warn": like "keep" but emits high-missingness warnings.
- na_warn_prop
Numeric in \([0,1]\); per-variable threshold for high-missingness warnings. Default 0.2.
- verbose
Logical; if TRUE, prints stepwise messages and a completion summary. Default TRUE.
Details
This function preserves prior behavior by default:
Inputs are taken as-is; NA values propagate to outputs (na_action = "keep").
No capping or out-of-range checks are applied.
Units (no automatic conversion):
age: years; sex: 1 = male, 2 = female
eGFR: mL/min/1.73 m^2
UACR: mg/g (albumin-to-creatinine ratio)
Details
Prognostic index:
PI = 0.220 x log(age) + (-0.556) x log(eGFR) + 0.451 x log(UACR) + 0.391 x (male)where male = 1 if sex == 1, else 0.Baseline survival: S0(2y) = 0.934, S0(5y) = 0.881 (Tangri 2011).
Risks: KFRE_t = 1 - (S0_t ^ exp(PI)).
The 2016 JAMA study provides a large, multinational validation of the KFRE in humans.
This implementation computes the original 4-variable linear predictor and does not apply recalibration or alternative coefficient sets.
References
Tangri N, Stevens LA, Griffith J, others (2011). “A predictive model for progression of chronic kidney disease to kidney failure.” JAMA, 305(15), 1553–1559. doi:10.1001/jama.2011.451 . Tangri N, Grams ME, Levey AS, others (2016). “Multinational assessment of accuracy of equations for predicting risk of kidney failure: a meta-analysis.” JAMA, 315(2), 164–174. doi:10.1001/jama.2015.18202 .
Examples
library(tibble)
df <- tibble(
age = c(65, 72),
sex = c(1, 2), # 1 = male, 2 = female
eGFR = c(45, 22), # mL/min/1.73 m^2
UACR = c(300, 1200) # mg/g
)
# Default behavior (NA propagate, no extreme checks)
kidney_failure_risk(
data = df,
col_map = list(age = "age", sex = "sex", eGFR = "eGFR", UACR = "UACR")
)
#> kidney_failure_risk(): reading input 'df' — 2 rows × 4 variables
#> kidney_failure_risk(): col_map: age -> 'age', sex -> 'sex', eGFR -> 'eGFR', UACR -> 'UACR'
#> kidney_failure_risk(): computing markers:
#> KFRE_2yr [age, sex, eGFR, UACR -- 2-year kidney failure risk]
#> KFRE_5yr [age, sex, eGFR, UACR -- 5-year kidney failure risk]
#> kidney_failure_risk(): results: KFRE_2yr 2/2, KFRE_5yr 2/2
#> # A tibble: 2 × 2
#> KFRE_2yr KFRE_5yr
#> <dbl> <dbl>
#> 1 0.329 0.523
#> 2 0.536 0.759
# With verbose output
# \donttest{
kidney_failure_risk(
data = df,
col_map = list(age = "age", sex = "sex", eGFR = "eGFR", UACR = "UACR"),
verbose = TRUE
)
#> kidney_failure_risk(): reading input 'df' — 2 rows × 4 variables
#> kidney_failure_risk(): col_map: age -> 'age', sex -> 'sex', eGFR -> 'eGFR', UACR -> 'UACR'
#> kidney_failure_risk(): computing markers:
#> KFRE_2yr [age, sex, eGFR, UACR -- 2-year kidney failure risk]
#> KFRE_5yr [age, sex, eGFR, UACR -- 5-year kidney failure risk]
#> kidney_failure_risk(): results: KFRE_2yr 2/2, KFRE_5yr 2/2
#> # A tibble: 2 × 2
#> KFRE_2yr KFRE_5yr
#> <dbl> <dbl>
#> 1 0.329 0.523
#> 2 0.536 0.759
# }