# goofcat: Goodness of fit measures for categorical variable models In ithir: Functions and Algorithms Specific to Pedometrics

## Description

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.

## Usage

 `1` ```goofcat(observed = NULL, predicted = NULL, conf.mat, imp=FALSE) ```

## Arguments

 `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 `conf.mat` parametisation, this is set to `TRUE`. Default is `FALSE`.

## Value

Returns an element labelled `list` containing the goodness of fit statistics.

## Note

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

## Examples

 ``` 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) ```

ithir documentation built on May 2, 2019, 4:49 p.m.