# Present results from a multinomial model graphically

I am working with a bunch of multinomial models, and presenting the tables with all the coefficients is getting to be quite tedious, do you guys know of any ressources that show how to present such models graphically, so all the tables could be excluded, or put in an appendix?

• In case you are nevertheless interested in the coefficients,

• and your "bunch of models" is equal to each other (e.g. out of bootstrap or iterated/repeated cross validation, or model ensemble)

Then you could plot the coefficients over the variate (boxplot, mean ± standard deviation, ...):

Of course, if you have only few variates, you may summarize your table along these lines.

In addition, you can multiply your coefficients with your (test) data element wise and plot those results over the variates. This can give you an idea which variate contributes how strongly to the final result (works already with just one model):

I've been using this to discuss LDA models (that's why the graphic says LD coefficient), but it basically works the same as long as the scores (results $\beta X$) can be brought to have the same meaning across the models and there's a coefficient for each variate. Note that I work with spectroscopic data sets, so I have the additional advantage that the variates have an intrinsic order with physical meaning (the spectral dimension, e.g. wavelength or wavenumber as in the example).

If you need details, here's the whole story.

And here's a code example (the data set is not pre-processed, so the model probably doesn't make much sense)

library (hyperSpec) # I'm working with spectra
# and use the chondro data set
## make a model
library (MASS)
model <- lda (clusters ~ spc, data = chondro$.) # this is a really terrible # thing to do: the data set # has only rank 10! ## make the coefficient plot coef <- decomposition (chondro, t (coef (model)), scores = FALSE) plot (coef, stacked = TRUE)  • decomposition makes a hyperSpec object from the coefficients. If you are not working with spectra, you may want to plot coef (model) directly • If I have more models, I plot e.g. mean ± 1 sd of the coefficients Now the contribution spectra: contributions <- lapply (1 : 2, function (i) sweep (chondro, 2, coef [[i,]], *) ) contributions <- do.call (rbind, contributions) contributions$coef <- rep (1 : 2, each = nrow (chondro))

tmp <- aggregate (contributions,
list (contributions$clusters, contributions$coef),
FUN = mean_pm_sd)

cols <- c ("dark blue", "orange", "#C02020")
plotspc (tmp, stacked = ".aggregate", fill = ".aggregate",
col = rep (cols, 2))

• Wauw, I really like those plots, did you do this in R? If so could I have a look at the code? Jul 31, 2011 at 10:26
• Thomas, yes I did them in R. Sure I can give you the code. What exactly do you need? Aug 1, 2011 at 7:30
• If it is possible, a small self contained example would be great, i.e. a small data frame with some data and code to create the plots based on this data. Aug 1, 2011 at 8:51

What you are typically interested in is not the coefficients but probably marginal effects or something similar. Here is a package that plots these for you: http://cran.r-project.org/web/packages/effects I think it was featured in R magazine, but the examples are picturesque enough.

• Thanks a lot for the link, I did not know of this package! Jul 27, 2011 at 14:26