A table providing performance metrics per unique cause based on input predicted and observed cases.
internalGetCauseMetrics(pred, obs, causes = unique(c(pred, obs)))
Chracter vector of predicted causes for each case.
Character vector of observed causes for each case.
Character vector of all possible causes including ones that are not in the pred or obs.
out Dataframe of a performance metrics per cause (see Methods documentation):
Columns: Cause, TruePositives, TrueNegatives, FalsePositives, FalseNegatives, PredictedFrequency, ObservedFrequency, Sensitivity, CSMFpredicted, CSMFobserved
Cause (vectorof char): The unique causes from both the obs and pred inputs
Sensitivity (vectorof double): the sensitivity for a cause
CSMFpredicted (vectorof double): the cause specific mortality fraction for a cause given the predicted deaths
CSMFobserved (vectorof double): the cause specific mortality fraction for a cause given the observed deaths
TruePositives (vectorof double): The total number of true positives per cause
TrueNegatives (vectorof double): The total number of true negatives per cause
FalsePositives (vectorof double): The total number of false positives per cause
FalseNegatives (vectorof double): The total number of false negatives per cause
PredictedFrequency (vectorof double): The occurence of a cause in the pred input
ObservedFrequency (vectorof double): The occurence of a cause in the obs input
Example:
Cause | Sensitivity | Metric-n.. | HIV |
0.5 | #.. | Cause | Sensitivity |
This code is built on the original performance metrics code provided by Dr. Mireille Gomes.
Other internal functions:
internalGetCSMFAcc()
,
internalGetCSMFMaxError()
,
internalGetMetrics()
,
internalNBC()
# NOT RUN {
library(nbc4va)
pred <- c("HIV", "Stroke", "HIV", "Stroke")
obs <- c("HIV", "HIV", "Stroke", "Stroke")
cmetrics <- nbc4va::internalGetCauseMetrics(pred, obs)
# }
Run the code above in your browser using DataLab