getPhecodeOccurrences | R Documentation |
This is typically the first step of an analysis using phenotype risk scores,
the next is getWeights()
.
getPhecodeOccurrences(
icdOccurrences,
icdPhecodeMap = phers::icdPhecodeMap,
dxIcd = phers::diseaseDxIcdMap
)
icdOccurrences |
A data.table of occurrences of ICD codes for each
person in the cohort. Must have columns |
icdPhecodeMap |
A data.table of the mapping between ICD codes and
phecodes. Must have columns |
dxIcd |
A data.table of ICD codes to exclude from mapping to phecodes.
Must have columns |
A data.table of phecode occurrences for each person.
getWeights()
, getScores()
library('data.table')
# map ICD codes to phecodes
phecodeOccurrences = getPhecodeOccurrences(icdSample)
# calculate weights (using the prevalence method)
weights = getWeights(demoSample, phecodeOccurrences)
# OMIM disease IDs for which to calculate phenotype risk scores
diseaseId = 154700
# map diseases to phecodes
diseasePhecodeMap = mapDiseaseToPhecode()
# calculate scores
scores = getScores(weights, diseasePhecodeMap[disease_id == diseaseId])
# calculate residual scores
rscores = getResidualScores(demoSample, scores, lmFormula = ~ sex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.