QDiabetes-package {QDiabetes} | R Documentation |
Type 2 Diabetes Risk Calculator
Description
This package calculates the risk of developing type 2 diabetes using risk prediction algorithms, which were initially derived by ClinRisk. Currently, these include QDiabetes-2013 and QDiabetes-2018, although older (and eventually more recent) versions of QDiabetes will be included in future releases.
Details
The package consistes of four risk prediction functions for use in estimating the risk of developing type 2 diabetes:
QDR2013
- For estimating the 1–10-year risk using QDiabetes-2013.QDR2018A
- For estimating the 10-year risk using QDiabetes-2018 (Model A).QDR2018B
- For estimating the 10-year risk using QDiabetes-2018 (Model B).QDR2018C
- For estimating the 10-year risk using QDiabetes-2018 (Model C).
The following variables are used by each risk prediction function present in this package:
Description | Variable | Type | QDR2013 | QDR2018A | QDR2018B | QDR2018C |
Gender | sex | character | x | x | x | x |
Age | age | double | x | x | x | x |
Body mass index (BMI) | bmi | double | x | x | x | x |
Ethnicity | ethn | character | x | x | x | x |
Smoking status | smoke | character | x | x | x | x |
Deprivation | tds | double | x | x | x | x |
Fasting plasma glucose (FPG) | fpg | double | x | |||
Glycated haemoglobin (HbA1c) | hba1c | double | x | |||
Family history of diabetes | fhdm | logical | x | x | x | x |
History of treated hypertension | htn | logical | x | x | x | x |
History of cardiovascular disease | cvd | logical | x | x | x | x |
History of gestational Diabetes | gdm | logical | x | x | x | |
History of polycystic ovary syndrome | pcos | logical | x | x | x | |
History of learning difficulties | learn | logical | x | x | x | |
History of schizophrenia or bipolar affective disorder | psy | logical | x | x | x | |
History of corticosteroid use | ster | logical | x | x | x | x |
History of statin use | stat | logical | x | x | x | |
History of use of 2nd generation antipsychotics | apsy | logical | x | x | x | |
Survival time | surv | integer | x |
NB: height (ht
) and weight (wt
) may be specified in place of body mass index (bmi
) in any of the above functions.
As per R's general coding sytax, factor or character values may be passed to any risk prediction function parameter where a character value is expected, so long as the factor variable label matches one of the expected character strings. Similarly, 0
or 1
many be used in place of FALSE
or TRUE
for any function parameter where a logical value is expected.
Disclaimer
ClinRisk do not support of endorse this code. End users should see the original C source as the 'gold standard' open source implementation. Please note that the QDiabetes R package has been created as a research tool for scientific purposes only. The QDiabetes R package has not been granted Medicines and Healthcare products Regulatory Agency (MHRA) approval as a medical device, and hence, should not be used as part of any individualised risk assessment.
Funding
This project was funded by the National Institute for Health Research (NIHR) School for Primary Care Research (SPCR) [project number: 412]. The views expressed are those of the author(s) and not necessarily those of the NIHR or the Department of Health and Social Care.
Note
Many of the default values used in the risk prediction functions of this package were selected to be representative of a UK population. These values are only intended to minimise the amount of typing required when using the risk prediction functions in an exploratory manner. They are unlikely to be useful in a research setting, and you would need to know the exact values to assign to all function parameters in order to make accurate risk predictions. Hence, while you can get risk preditions from the QDR2013
and QDR2018A
functions through the specification of only sex
, age
, and bmi
, you would be assuming White or missing ethnicity, non-smoking status, a Townsend deprivation score of 0, and the complete absence of any relevant medical history/conditions and concommitant drug therapies. In the case of QDR2013
, you would also be assuming that a 10-year risk window is desired.
Author(s)
Benjamin G. Feakins benjamin.feakins@ndph.ox.ac.uk
References
Hippisley-Cox, J., Coupland, C., Robson, J., Sheikh, A. and Brindle, P. (2009). Predicting risk of type 2 diabetes in England and Wales: prospective derivation and validation of QDScore. BMJ 338, b880. doi: 10.1136/bmj.b880
Hippisley-Cox, J. and Coupland, C. (2017). Development and validation of QDiabetes-2018 risk prediction algorithm to estimate future risk of type 2 diabetes: cohort study. BMJ 359, j5019. doi: 10.1136/bmj.j5019
See Also
getTDS
- For looking up Townsend deprivation scores from UK postcodes.
dat_qdr
- QDiabetes sample dataset.
Examples
### Simple usage
## QDiabetes-2013
QDR2013(sex = "Female", age = 76, ht = 1.65, wt = 70)
QDR2013(sex = "Male", age = seq(25, 80, 5), bmi = 40, ethn = "Other", tds = 5)
## QDiabetes-2018
# Model A
QDR2018A(sex = "Female", age = 76, ht = 1.65, wt = 70)
QDR2018A(sex = "Male", age = seq(25, 80, 5), bmi = 40, ethn = "Other", tds = 5)
# Model B (inc. FPG)
QDR2018B(sex = "Female", age = 76, ht = 1.65, wt = 70, fpg = 4)
QDR2018B(sex = "Male", age = 55, bmi = 40, fpg = 2:6, ethn = "BlackCaribbean")
# Model C (inc. HbA1c)
QDR2018C(sex = "Female", age = 76, ht = 1.65, wt = 70, hba1c = 25)
QDR2018C(sex = "Male", age = 55, bmi = 40, hba1c = seq(15, 40, 5), ethn = "Chinese")
### Using postcodes to estimate Townsend deprivation scores
## QDiabetes-2013
QDR2013(sex = "Male", age = 65, bmi = 40, tds = getTDS("OX3 7LF"))
QDR2013(sex = "Female", age = 60, bmi = 35, tds = getTDS(c("OX2 6NW", "OX2 6GG")))
## QDiabetes-2018
# Model A
QDR2018A(sex = "Male", age = 65, bmi = 40, tds = getTDS("OX3 7LF"))
QDR2018A(sex = "Female", age = 60, bmi = 35, tds = getTDS(c("OX2 6NW", "OX2 6GG")))
# Model B (inc. FPG)
QDR2018B(sex = "Male", age = 65, bmi = 40, fpg = 6, tds = getTDS("OX3 7LF"))
QDR2018B(sex = "Female", age = 60, bmi = 35, fpg = 6, tds = getTDS(c("OX2 6NW", "OX2 6GG")))
# Model C (inc. HbA1c)
QDR2018C(sex = "Male", age = 65, bmi = 40, hba1c = 42, tds = getTDS("OX3 7LF"))
QDR2018C(sex = "Female", age = 60, bmi = 35, hba1c = 42, tds = getTDS(c("OX2 6NW", "OX2 6GG")))