getPhecodeOccurrences {phers} | R Documentation |
Map ICD code occurrences to phecode occurrences
Description
This is typically the first step of an analysis using phenotype risk scores,
the next is getWeights()
.
Usage
getPhecodeOccurrences(
icdOccurrences,
icdPhecodeMap = phers::icdPhecodeMap,
dxIcd = phers::diseaseDxIcdMap
)
Arguments
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 |
Value
A data.table of phecode occurrences for each person.
See Also
Examples
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)
[Package phers version 1.0.2 Index]