Description Usage Arguments Value Note Author(s) References Examples
This function performs a number of model diagnostic goodness of fit measures for categorical variables which include: Overall accuracy, Producer's Accuracy, User's Accuracy, and Kappa Statistic. See Congalton (1991) for details on these statistics. They are commonly used to assess the performance of models where the target variable is a class or category.
1 |
observed |
a vector values that could either be integer or character class that are actual observations of some categorical phenomenon. |
predicted |
a vector values that could either be integer or character class that are predictions of the phenomenon that was observed. |
conf.mat |
matrix; Optional input. A square matrix called a confusion matrix that summarizes observation and subsequent prediction from a particular model. |
imp |
logical; If a confusion matrix is being entered directly into the function through the |
Returns an element labelled list
containing the goodness of fit statistics.
If for whatever reason the conf.mat
input is not of matrix
class, and is not square in dimension the function will halt and provide an error message.
Brendan Malone
Congalton, R. G., (1991) A review of assessing the accuracy of classifications of remotely sensed data.. Remote Sensing of the Environment, 37:35-46.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(ithir)
#Using a pre-constructed confusion matrix
con.mat <- matrix(c(5, 0, 1, 2, 0, 15, 0, 5, 0, 1, 31, 0, 0, 10, 2, 11),
nrow = 4, ncol = 4)
rownames(con.mat) <- c("DE", "VE", "CH", "KU")
colnames(con.mat) <- c("DE", "VE", "CH", "KU")
con.mat
goofcat(conf.mat = con.mat, imp=TRUE)
#Using observations and corresponding predictions
#Using random intgers
set.seed(123)
observed<- sample(1:5,1000,replace=TRUE)
set.seed(321)
predicted<- sample(1:5,1000,replace=TRUE)
goofcat(observed = observed, predicted = predicted)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.