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?


2 Answers 2

  • 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, ...): coefficients over variates

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): contributions of each variate to the score

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))
  • $\begingroup$ Wauw, I really like those plots, did you do this in R? If so could I have a look at the code? $\endgroup$ Commented Jul 31, 2011 at 10:26
  • $\begingroup$ Thomas, yes I did them in R. Sure I can give you the code. What exactly do you need? $\endgroup$ Commented Aug 1, 2011 at 7:30
  • $\begingroup$ 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. $\endgroup$ Commented 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.