Learn R Programming

nbc4va (version 1.2)

internalGetCauseMetrics: Calculate performance metrics table per cause

Description

A table providing performance metrics per unique cause based on input predicted and observed cases.

Usage

internalGetCauseMetrics(pred, obs, causes = unique(c(pred, obs)))

Arguments

pred

Chracter vector of predicted causes for each case.

obs

Character vector of observed causes for each case.

causes

Character vector of all possible causes including ones that are not in the pred or obs.

Value

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

Details

This code is built on the original performance metrics code provided by Dr. Mireille Gomes.

See Also

Other internal functions: internalGetCSMFAcc(), internalGetCSMFMaxError(), internalGetMetrics(), internalNBC()

Examples

Run this code
# 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