BHSCalculator: Biological Health Score (BHS) calculator

Description Usage Arguments Details Value References Examples

View source: R/BHS.R

Description

This function implements the BHS calculation method presented by Karimi et. al(2018).

Usage

1
2
3
4
5
6
7
BHSCalculator(
  bio_df,
  reference,
  stratified = FALSE,
  bySystems = TRUE,
  lookUpTable = bio.dict
)

Arguments

bio_df

Dataframe containing the biomarkers and the age and gender information if stratified analyis is desired. Additionally the IDs need to be available in the dataframes rownames. Example dataframe provided at: HDATDS::bio.example

reference

Which reference from the look-up table to use. Options are: "Mantej", "Paper" or "Barbara" This reference is used for both the "by systems" calculation and the quantiles calculation

stratified

Whether or not the BHS calculation should be performed stratifiying by age group and gender group or not (at the moment only these stratifications are supported and are not customisable)

bySystems

Whether or not the BHS calculation should be done by first calculating scores by system and then calculating the mean across systems (bySystems = TRUE) or simply taking the non weighted average of all the biomarker scores (bySystems = FALSE)

lookUpTable

Dataframe containing the reference values to look up. Can be made custom but will need to have the same biomarker names than bio.dict. Load bio.dict: bio.dict = data("bio.dict") (set equal to bio.dict [internal variable] by default)

Details

The function has 3 main working parts:

1. Making a quantile look-up table: this part calls the function HDATDS::quantile_check() to calculate the relevant quartiles for the given combination of biomarkers and reference choice.

2. For every biomarker (and each strata if relevant (and if stratified = TRUE)), get the score for each individual

3. Calculate the aggregated score (by systems if bySystems is TRUE)

Value

A vector containing all the biological health scores for all inviduals. The vector is sorted in the same order than the original data frame (bio_df) so that it can simply be concatenated (cbind) to the original dataframe. Additionally, the rownames of the output contain the original rownames (IDs)

References

Karimi, Maryam, Raphaële Castagné, Cyrille Delpierre, Gaëlle Albertus, Eloïse Berger, Paolo Vineis, Meena Kumari, Michelle Kelly-Irving, and Marc Chadeau-Hyam. 2019. “Early-Life Inequalities and Biological Ageing: A Multisystem Biological Health Score Approach in Understanding Society.” Journal of Epidemiology and Community Health 73(8):693–702.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Original biomarker dataframe
data("bio.example")
data("cov")
# Load biomarkers and covariates data frames (bio and cov) and merge them by ID
bio = merge(bio.example, cov[,c("ID","age_cl","gender")], by = "ID")
ids = bio$ID # keeping explicit copy of IDs
rownames(bio) = bio[,1] # assuming ID is the first column
bio = bio[,-1]
bio$age_cl = as.factor(bio$age_cl)
bio$gender = as.factor(bio$gender)

bio = bio[complete.cases(bio), ] #function does not handle NAs internally

# Run BHS calculation using paper reference
scores_paper = BHSCalculator(bio, "Paper", stratified = TRUE, bySystems = TRUE)

lc5415/HDATDS documentation built on April 27, 2020, 6:04 a.m.