classificationStats: calculate prediction performance statistics for...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/classificationStats.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
#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 Sept. 23, 2018, 5:17 a.m.