Skip to content
Prev 332682 / 398502 Next

How to plot results of clmm()?

On 11/4/2013 9:13 AM, thomas wrote:
You're right that clm() and clmm() models are not supported by the 
effects package.  In principle, this would not be too difficult to add, 
*if* the ordinal package contained the standard collection of methods for
'clm' and 'clmm' objects --- coef(), vcov(), and importantly, predict().
Unfortunately, there is no predict method, and clmm objects don't 
inherit from anything else:

 > methods(class="clmm")
  [1] anova.clmm*      condVar.clmm*    extractAIC.clmm* logLik.clmm*
  [5] nobs.clmm*       print.clmm*      ranef.clmm       summary.clmm*
  [9] VarCorr.clmm     vcov.clmm*
 > class(modc)
[1] "clmm"
 >

If there were, you could simply do what effects does yourself --
obtain predicted values (and CIs) over a grid of values, and plot them,

xlevels <- expand.grid(list(age=seq(20,90,10),
               gender=levels(BEPS$gender), vote=levels(BEPS$vote)))

You can, of course, obtain all the fitted values, and plot those,
but that lacks the simplicity of effect plots in averaging over factors
not shown in a given plot.

library(ordinal)
  modc <- clmm(as.factor(political.knowledge) ~ age + gender +
(1|vote), data=BEPS)

BEPS$fitted <- fitted(modc)
plot(fitted~age, data=BEPS, col=c("red", "blue")[gender])