View source: R/classificationStats.R
classificationStats | R Documentation |
this function calculates prediction performance statistics between vectors of predicted and observed values. Users may also create a dotplot visualising the results.
classificationStats(prd, obs, prob = NULL, plot = FALSE)
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 |
If plot = FALSE
(the default), a data frame.
If plot = TRUE
, a list with components stats
- data frame
and plot
- a trellis plot object.
Hanna Meyer and Tim Appelhans
regressionStats
#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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.