Learn R Programming

pscl (version 1.5.5)

hitmiss: Table of Actual Outcomes against Predicted Outcomes for discrete data models

Description

Cross-tabulations of actual outcomes against predicted outcomes for discrete data models, with summary statistics such as percent correctly predicted (PCP) under fitted and null models. For models with binary responses (generalized linear models with family=binomial), the user can specific a classification threshold for the predicted probabilities.

Usage

hitmiss(obj, digits = max(3, getOption("digits") - 3), ...)

# S3 method for glm hitmiss(obj,digits=max(3,getOption("digits")-3), ..., k=.5)

Value

For hitmiss.glm, a vector of length 3:

pcp

Percent Correctly Predicted

pcp0

Percent Correctly Predicted among y=0

pcp1

Percent Correctly Predicted among y=1

Arguments

obj

a fitted model object, such as a glm with family=binomial, a polr model for ordinal responses, or a multinom model for unordered/multinomial outcomes

digits

number of digits to display in on-screen output

...

additional arguments passed to or from other functions

k

classification threshold for binary models

Author

Simon Jackman simon.jackman@sydney.edu.au

Details

For models with binary responses, the user can specify a parameter 0 < k < 1; if the predicted probabilities exceed this threshold then the model is deemed to have predicted y=1, and otherwise to have predicted y=0. Measures like percent correctly predicted are crude summaries of model fit; the cross-tabulation of actual against predicted is somewhat more informative, providing a little more insight as to where the model fits less well.

See Also

pR2 for pseudo r-squared; predict; extractAIC. See also the ROCR package and the lroc function in the epicalc package for ROC computations for assessing binary classifications.

Examples

Run this code
data(admit)
## ordered probit model
op1 <- MASS::polr(score ~ gre.quant + gre.verbal + ap + pt + female,
            Hess=TRUE,
            data=admit,
            method="probit")
hitmiss(op1)

Run the code above in your browser using DataLab