View source: R/sp.categorical.R
sp.categorical | R Documentation |
This function generates separation plots for polytomous dependent variables.
sp.categorical(pred, actual, file = NULL, cex = 1.5, ...)
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 |
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.
None. This function is used for its side effects only.
Brian Greenhill <bgreenhill@albany.edu>
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 separationplot
for a description of the core function for generating separation plots.
# 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!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.