Skip to contents

Estimates the 10-year probabilities of major osteoporotic and hip fracture using a simplified, non-validated approximation based on FRAX risk factors. This is for development/demo only and does not implement the proprietary FRAX algorithm.

Usage

frax_score(
  data,
  col_map = NULL,
  na_action = c("keep", "omit", "error", "ignore", "warn"),
  country = NULL,
  verbose = TRUE
)

Arguments

data

A data frame or tibble with inputs.

col_map

Named list mapping required and optional inputs:

  • Required: age, sex

  • Optional binary risk factors: prior_fracture, parent_fracture, steroids, rheumatoid, secondary_op, smoker, alcohol

  • Optional: bmd (T-score; if present and in (-5,0], used to adjust risk)

na_action

One of c("keep","omit","error","ignore","warn").

country

optional country/region code for FRAX calibration (accepted, currently unused).

verbose

Logical; if TRUE, emits progress via rlang::inform.

Value

Tibble with frax_major_percent and frax_hip_percent.

Details

Important: this function is an educational placeholder and must not be used for clinical decision-making, patient counseling, or guideline-based treatment selection.

Examples

df <- data.frame(Age = c(65, 72, 58), Sex = c("female", "female", "male"))
frax_score(df)
#> frax_score(): reading input 'df' — 3 rows × 2 variables
#> frax_score(): col_map (2 columns — 2 inferred from data)
#>   age               ->  'Age'    (inferred)
#>   sex               ->  'Sex'    (inferred)
#> frax_score(): computing markers:
#>   frax_major_percent [age, sex, risk factors, bmd]
#>   frax_hip_percent [age, sex, risk factors, bmd]
#> frax_score(): results: frax_major_percent 3/3, frax_hip_percent 3/3, frax_sex_norm 3/3, frax_age_used 3/3, frax_bmd_tscore 0/3
#> # A tibble: 3 × 5
#>   frax_major_percent frax_hip_percent frax_sex_norm frax_age_used
#>                <dbl>            <dbl> <chr>                 <dbl>
#> 1                6.5              3.6 female                   65
#> 2                8.6              5.3 female                   72
#> 3                2.6              1.2 male                     58
#> # ℹ 1 more variable: frax_bmd_tscore <dbl>