classificationStats: calculate prediction performance statistics for...

View source: R/classificationStats.R

classificationStatsR Documentation

calculate prediction performance statistics for classification models

Description

this function calculates prediction performance statistics between vectors of predicted and observed values. Users may also create a dotplot visualising the results.

Usage

classificationStats(prd, obs, prob = NULL, plot = FALSE)

Arguments

prd

factor vector of predicted values with two levels

obs

factor vector of observed values with two levels

prob

optional. Predicted probabilities for the first class

plot

logical, whether to produce a visualisation of the results. Defaults to FALSE

Value

If plot = FALSE (the default), a data frame. If plot = TRUE, a list with components stats - data frame and plot - a trellis plot object.

Author(s)

Hanna Meyer and Tim Appelhans

See Also

regressionStats

Examples

#create two random vectors with classes "yes" and "no" to simulate a model
#with random performance. Expected POD and PFD  
pred_vals <- factor(sample(c("Yes","No"), 50, replace = TRUE),levels=c("Yes","No"))
obs_vals <- factor(sample(c("Yes","No"), 50, replace = TRUE),levels=c("Yes","No"))

result <- classificationStats(pred_vals, obs_vals, plot=TRUE)
result$plot
result$stats


environmentalinformatics-marburg/Rsenal documentation built on July 28, 2023, 6:09 a.m.