Skip to contents

find_threshold() is an S7 generic that finds the optimal probability classification threshold for a set of probabilities or an estimated diagnostic classification model with one of the following classes:

  • numeric: A vector of probabilities (e.g., the probabilities of proficiency on a single attribute).

  • data.frame or matrix: Probabilities for multiple attributes, with one column per attribute. All columns must be numeric, so remove any respondent identifiers first. Column names are used as the attribute names. Unnamed matrix columns are named A1, A2, etc.

  • measr

  • GDINA

  • CDM

Usage

find_threshold(
  x,
  ...,
  approx_method = c("resample", "iterate"),
  optimal_method = "youden"
)

Arguments

x

A numeric vector of probabilities, a data frame or matrix of probabilities with one column per attribute, or an estimated model object.

...

Additional arguments passed to the approximation function defined by approx_method.

approx_method

The approximation method to use. One of "resample", which will use optimal_resample() or "iterate", which will use optimal_iterate().

optimal_method

The method for estimating the optimal threshold. One of "youden", "topleft", "cz", "gmean", "iu", "minp".

Value

A tibble with one row per threshold and (if applicable) per attribute. For each attribute, the estimated optimal threshold is listed first, followed by any comparison thresholds. For a numeric vector, the result is the same as calling optimal_resample() or optimal_iterate() directly, and there is no attribute column.

When approx_method = "iterate", the returned object also has the "converged" and "diagnostics" attributes described in optimal_iterate(). For multiple attributes, these are combined across attributes: "converged" is TRUE only if all attributes converged, and "diagnostics" includes an additional attribute column identifying the attribute for each row.