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

Description Usage Arguments Value Examples

View source: R/compute.acc.R

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

1
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

1
2
3
4
5
6
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)

RTIInternational/mobForest documentation built on Aug. 3, 2019, 8:28 a.m.