mobForest (version 1.3.1)

compute.acc: Predictive accuracy estimates across trees for logistic regression model

Description

Compute predictive accuracy of response variable with binary outcome. The function takes observed and predicted binary responses as input and computes proportion of observations classified in same group.

Usage

compute.acc(response, predictions, prob_cutoff = 0.5)

Arguments

response

A vector of binary outcome.

predictions

A matrix of predicted probabilities (logit model) for out-of-bag observations for each tree.

prob_cutoff

The threshold for predicting 1's & 0's.

Value

Predictive accuracy estimate ranging between 0 and 1.

Examples

Run this code
# NOT RUN {
response <- as.data.frame( c(rep(0, 10000), rep(1, 10000)))
predictions <-
  matrix(nrow = 20000, ncol = 3,
         data = c(rep(.1, 15000), rep(.8, 5000), rep(.1, 15000),
                  rep(.8, 5000), rep(.1, 15000), rep(.8, 5000)))
compute.acc(response, predictions, prob_cutoff = .5)
# }

Run the code above in your browser using DataCamp Workspace