internalGetCauseMetrics: Calculate performance metrics table per cause

View source: R/nbc4va_internal.R

internalGetCauseMetricsR Documentation

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.

Details

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

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 #..
Stroke 0.5 #..

See Also

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

Examples

library(nbc4va)
pred <- c("HIV", "Stroke", "HIV", "Stroke")
obs <- c("HIV", "HIV", "Stroke", "Stroke")
cmetrics <- nbc4va::internalGetCauseMetrics(pred, obs)


rrwen/nbc4va documentation built on May 11, 2022, 9:45 p.m.