sp.categorical {separationplot} | R Documentation |
Separation plots for variables with more than two outcome levels
Description
This function generates separation plots for polytomous dependent variables.
Usage
sp.categorical(pred, actual, file = NULL, cex = 1.5, ...)
Arguments
pred |
A matrix of fitted values. Each row represents one observation, and each column represents the probability of obtaining that outcome. The column names correspond to the outcome categories. |
actual |
A vector containing the actual outcomes corresponding to each observation. |
file |
The name and file path of where the pdf output should be written, if desired. If |
cex |
Character expansion factor used for the outcome category labels. |
... |
Additional arguments passed to |
Details
This function is a wrapper for separationplot
that generates a series of separation plots for each outcome category for a variable with more than two outcomes.
Please see the paper by Greenhill, Ward and Sacks for more information on the features of the separation plot.
Value
None. This function is used for its side effects only.
Author(s)
Brian Greenhill <bgreenhill@albany.edu>
References
Greenhill, Brian, Michael D. Ward, and Audrey Sacks. "The separation plot: A new visual method for evaluating the fit of binary models." American Journal of Political Science 55.4 (2011): 991-1002.
See Also
See separationplot
for a description of the core function for generating separation plots.
Examples
# This example borrows code from the example given in the documentation for the polr() function
# that uses the "housing" dataset:
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
sp.categorical(pred=house.plr$fitted.values,
actual=as.character(house.plr$model[,1]), type="rect", lwd2=2)
# not a very good fit!