sensspec: Sample size and precision of sensitivity and specificity

prec_sensR Documentation

Sample size and precision of sensitivity and specificity

Description

Because sensitivity (true positives/total number of positives) and specificity (true negatives/total number of negatives) are simple proportions, these functions act as wrappers for prec_prop.

Usage

prec_sens(
  sens,
  n = NULL,
  ntot = NULL,
  prev = NULL,
  conf.width = NULL,
  round = "ceiling",
  ...
)

prec_spec(
  spec,
  n = NULL,
  ntot = NULL,
  prev = NULL,
  conf.width = NULL,
  round = "ceiling",
  ...
)

Arguments

sens, spec

proportions.

n

number of observations.

ntot

total sample size.

prev

prevalence of cases/disease (i.e. proportion of ntot with the disease).

conf.width

precision (the full width of the confidence interval).

round

string, round calculated n up (ceiling) or down (floor).

...

options passed to prec_prop (e.g. method, conf.width, conf.level).

Details

If ntot and prev are given, they are used to calculate n.

Value

Object of class "presize", a list of arguments (including the computed one) augmented with method and note elements.

Note

Calculated n can take on non-integer numbers, but prec_prop requires integers, so the calculated n is rounded according to the approach indicated in round.

See Also

prec_prop

Examples

  # confidence interval width with n
  prec_sens(.6, 50)
  # confidence interval width with ntot and prevalence (assuming 50% prev)
  prec_sens(.6, ntot = 100, prev = .5)
  # sample size with confidence interval width
  prec_sens(.6, conf.width = 0.262)

presize documentation built on March 7, 2023, 8:28 p.m.