proportion_difference: Calculate the confidence interval of a difference in...

View source: R/proportion_difference.R

proportion_differenceR Documentation

Calculate the confidence interval of a difference in proportions (e.g. sensitivity or specificity)

Description

Calculate a confidence interval for a difference in proportions, such as PPA or NPA. Uses the recommended method as described in Altman chapter 6 (loc 1249 in the Kindle edition) Here, the z-score is calculated using the stats::qnorm() function.

Usage

proportion_difference(
  true_calls_1,
  false_calls_1,
  true_calls_2,
  false_calls_2,
  interval = 0.95,
  digits = 0.1
)

Arguments

true_calls_1

The number of correct calls (true positives or true negatives) in the first proportion of interest.

false_calls_1

The number of incorrect calls (false positives or false negatives) in the first proportion of interest.

true_calls_2

The number of correct calls (true positives or true negatives) in the second proportion of interest.

false_calls_2

The number of incorrect calls (false positives or false negatives in the second proportion of interest).

interval

The confidence interval to calculate. Defaults to 0.95 for 95%.

digits

The number of digits to round to. Defaults to 0.1.

Details

Also known as "Newcombe's method".

Value

A list containing the estimated difference, the confidence interval, a boolean attribute indicating whether or not a difference was detected at the specified confidence (difference_detected), and various strings and formatted percents that can be used to convey the information.

Examples

proportion_difference(
  true_calls_1 = 99,
  false_calls_1 = 1,
  true_calls_2 = 80,
  false_calls_2 = 1,
  interval = 0.95
  )

bjoleary/dxr documentation built on Dec. 5, 2023, 8:33 p.m.