Description Usage Arguments Value Examples
Calculate biological ages in a dataset.
1 2 |
data |
The dataset for calculating biological age. |
agevar |
A character vector (length=1) indicating the name of the varialbe for age. |
biomarkers |
A character vector indicating the names of the variables for the biomarkers to use in calculating biological age. |
fit |
An S3 object for model fit. If the value is NULL, then the parameters to use for training biological age are calculated. |
filter |
a list with biomarker names that identifies any restrictions in training data. See vignette or data description for example of use. |
link |
"linear" is default and based on the original KDM algorithm; experimental use of log-linear link (use "log") is available for advanced users. |
s_ba2 |
A particular fit parameter. Advanced users can modify this parameter to control the variance of biological age. If left NULL, defaults are used. |
weightvar |
A character vector indicating survey weights. If supplied, a weighted regression is conducted. If not, weights are not used. |
controls |
A character vector indicating control variables (if any) to be used for calculating biological age. |
An object of class 'kdm'. This object is a list with two elements (data and fit), and two methods (extract_data and extract_fit).
1 2 3 4 5 6 7 8 9 10 11 12 | #(not run)
#Train biological age parameters
train = kdm_calc(nhanes,agevar='age',
biomarkers=c('sysbp','totchol','bun','cmv','mcv'))
#Use training data to calculate out-of-sample biological ages
biocalc = kdm_calc(data,agevar='age',
biomarkers=c('sysbp','totchol','bun','cmv','mcv'),
fit=train$fit)
#combine biological ages calculated using training parameters
data$bioage = extract_data(biocalc)[,'bioage']
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.