rStats.js v1.3.0
    Preparing search index...

    Function roc

    • The ROC curve of a numeric predictor of a binary response. Equivalent to pROC::roc() in R.

      The first level of the response is the control, the second the case (with more than two levels the first two are used, with pROC's warning). The thresholds are the midpoints between consecutive distinct values, with -Infinity and Infinity at the ends, and the points are stored as pROC stores them, by increasing specificity. The AUC is computed from the counts as U/(mn) and rounded once. Infinite predictor values are an error (pROC returns NaN with a warning), as are an empty class and, with naRm: false, missing values (pROC returns NA).

      Parameters

      • response: Float64Array<ArrayBufferLike> | readonly RocResponseValue[]

        The outcome: numbers, strings or booleans (null or NaN for a missing value).

      • predictor: Sample

        The predictor, numeric, of the same length (NaN for a missing value).

      • Optionaloptions: RocOptions

      Returns RocResult

      const r = roc([0, 0, 0, 1, 1, 1], [1, 2, 4, 3, 5, 6]);
      r.auc; // 0.8888888888888888
      r.thresholds; // [-Infinity, 1.5, 2.5, 3.5, 4.5, 5.5, Infinity]
    • The ROC curve from a formula response ~ predictor and a data frame; the rows where either is missing are dropped.

      Parameters

      • formula: string

        "response ~ predictor".

      • data: DataFrame

        The data frame: an object of columns (null or NaN for a missing value).

      • Optionaloptions: RocOptions

      Returns RocResult

    • The ROC curve from the predictor values of the controls and of the cases (pROC's roc(controls =, cases =)).

      Parameters

      Returns RocResult