Package: AgeTopicModels 0.3.0

AgeTopicModels: Inferring Age-Dependent Disease Topic from Diagnosis Data

We propose an age-dependent topic modelling (ATM) model, providing a low-rank representation of longitudinal records of hundreds of distinct diseases in large electronic health record data sets. The model assigns to each individual topic weights for several disease topics; each disease topic reflects a set of diseases that tend to co-occur as a function of age, quantified by age-dependent topic loadings for each disease. The model assumes that for each disease diagnosis, a topic is sampled based on the individual’s topic weights (which sum to 1 across topics, for a given individual), and a disease is sampled based on the individual’s age and the age-dependent topic loadings (which sum to 1 across diseases, for a given topic at a given age). The model generalises the Latent Dirichlet Allocation (LDA) model by allowing topic loadings for each topic to vary with age. References: Jiang (2023) <doi:10.1038/s41588-023-01522-8>.

Authors:Xilin Jiang [aut, cre]

AgeTopicModels_0.3.0.tar.gz
AgeTopicModels_0.3.0.zip(r-4.7-any)AgeTopicModels_0.3.0.zip(r-4.6-any)AgeTopicModels_0.3.0.zip(r-4.5-any)
AgeTopicModels_0.3.0.tgz(r-4.6-any)AgeTopicModels_0.3.0.tgz(r-4.5-any)
AgeTopicModels_0.3.0.tar.gz(r-4.7-any)AgeTopicModels_0.3.0.tar.gz(r-4.6-any)
AgeTopicModels_0.3.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
AgeTopicModels/json (API)

# Install 'AgeTopicModels' in R:
install.packages('AgeTopicModels', repos = c('https://xilin-jiang.r-universe.dev', 'https://cloud.r-project.org'))
Datasets:

On CRAN:

Conda:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

1.70 score 2 scripts 312 downloads 13 exports 36 dependencies

Last updated from:78cbce78d9. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK196
source / vignettesOK193
linux-releaseOK252
macos-releaseOK268
macos-oldrelOK289
windows-develOK278
windows-releaseOK267
windows-oldrelOK171
wasm-releaseOK95

Exports:%>%age_imputationdiseasematrix2longdataicd2phecodeloading2weightslongdata2diseasematrixplot_age_topicsplot_lfa_topicsprediction_ORsimulate_genetic_disease_from_topicsimulate_topicswrapper_ATMwrapper_LFA

Dependencies:clicpp11data.tabledplyrfarvergenericsggplot2ggrepelgluegtablegtoolsisobandlabelinglifecyclemagrittrpillarpkgconfigplyrpROCpurrrR6RColorBrewerRcppreshape2rlangS7scalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithr

Readme and manuals

Help Manual

Help pageTopics
imputing missing age if you can't find some of them The function does two stage imputation: i. if the individual has other age label - use the mean, min, or max of other age labels for the missing ones. ii. if the individual has no age label - use the mean, min, max for all the diagnosis codes iii. if there is no age info available for any of this code, we will impute it as the mean of all age codes in the dataage_imputation
Disease information linking PheCodes and ICD-10disease_info_phecode_icd10
Disease matrix reformatting for ATMdiseasematrix2longdata
Example HES diagnosis agesHES_age_example
Example HES ICD-10 diagnosesHES_icd10_example
Mapping the disease code from icd10 to phecodeicd2phecode
Mapping individuals to fixed topic loadings.loading2weights
Titlelongdata2diseasematrix
ICD-10 <-> PheCode mappingphecode_icd10
ICD-10-CM <-> PheCode mappingphecode_icd10cm
Title plot the topic loadings across age.plot_age_topics
Title plot topic loadings for LFA.plot_lfa_topics
Title Compute prediction odds ratio for a testing data set using pre-training ATM topic loading. Note only diseases listed in the ds_list will be used. The prediction odds ratio is the odds predicted by ATM versus a naive prediction using disease probability.prediction_OR
Short labels (at most first for letters/digits) for ICD-10 codesshort_icd10
Short labels (at most first for letters/digits) for ICD-10-CM codesshort_icd10cm
Simulate genetic-disease-topic structure (step 2)simulate_genetic_disease_from_topic
Simulate genetic-disease-topic structure (step 1)simulate_topics
SNOMED <-> ICD-10(-CM) mapping (excerpt)SNOMED_ICD10CM
List of 349 UK Biobank diseases (example)UKB_349_disease
Example topic model output (10 topics, UKB HES)UKB_HES_10topics
Run ATM on diagnosis data.wrapper_ATM
Run LFA on diagnosis data.wrapper_LFA