ROC {fake}R Documentation

Receiver Operating Characteristic (ROC)

Description

Computes the True and False Positive Rates (TPR and FPR, respectively) and Area Under the Curve (AUC) by comparing the true (observed) and predicted status using a range of thresholds on the predicted score.

Usage

ROC(observed, predicted, n_thr = NULL)

Arguments

observed

vector of binary outcomes.

predicted

vector of predicted scores.

n_thr

number of thresholds to use to construct the ROC curve. For faster computations on large data, values below length(predicted)-1 can be used.

Value

A list with:

TPR

True Positive Rate.

FPR

False Positive Rate.

AUC

Area Under the Curve.

See Also

Other goodness of fit functions: Concordance()

Examples


# Data simulation
set.seed(1)
simul <- SimulateRegression(
  n = 500, pk = 20,
  family = "binomial", ev_xy = 0.8
)

# Logistic regression
fitted <- glm(simul$ydata ~ simul$xdata, family = "binomial")$fitted.values

# Constructing the ROC curve
roc <- ROC(predicted = fitted, observed = simul$ydata)
plot(roc)


[Package fake version 1.4.0 Index]