Skip to content

ordinal regression with MCMCglmm

5 messages · Malcolm Fairbrother, Joshua Wiley, Jarrod Hadfield

#
Dear list,

I'm picking up on a thread from 2010 (https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q2/003678.html), about ordinal mixed models, fitted with clmm (from the ordinal package) and MCMCglmm.

I would like to fit an ordinal mixed model, with random slopes. Since clmm doesn't do random slopes, I'm trying with MCMCglmm, but I'm not sure I understand how MCMCglmm handles ordinal data.

To illustrate, I'll use the "wine" data from the ordinal package, and a model with only random intercepts.

library(ordinal)
library(MCMCglmm)

data(wine)
str(wine)
summary(fm2 <- clmm2(rating ~ temp + contact, random=judge, data=wine, Hess=TRUE, nAGQ=10))

# to get predicted probabilities for each possible of the five possible responses, for two combinations of covariates:
diff(plogis(c(-Inf,fm2$Theta, Inf) - fm2$beta %*% c(0,0))) # for tempcold and contactno
diff(plogis(c(-Inf,fm2$Theta, Inf) - fm2$beta %*% c(1,1))) # for tempwarm and contactyes

# compare with the raw data (seems to make sense...):
table(wine$rating[wine$temp=="cold" & wine$contact=="no"])
table(wine$rating[wine$temp=="warm" & wine$contact=="yes"])

# now fit the same model, using MCMCglmm:
prior1 <- list(R = list(V = 1, nu = 0.002, fix=1), G = list(G1 = list(V = 1, nu = 0.002)))
MC1 <- MCMCglmm(rating ~ temp + contact, random=~judge, data=wine, family="ordinal", prior=prior1, nitt=130000, thin=100, verbose=F)

# and get predicted probabilities, using the results from MCMCglmm, and the "hunch" approach Jarrod mentioned in the thread above:
diff(pnorm(c(-Inf, 0, colMeans(MC1$CP), Inf)-colMeans(MC1$Sol) %*% c(1,0,0), 0, sqrt(1+sum(colMeans(MC1$VCV))))) # for tempcold and contactno
diff(pnorm(c(-Inf, 0, colMeans(MC1$CP), Inf)-colMeans(MC1$Sol) %*% c(1,1,1), 0, sqrt(1+sum(colMeans(MC1$VCV))))) # for tempwarm and contactyes

The predicted probabilities are similar, but not similar enough that I'm sure this is right. Are the differences due to MCMC error, inappropriate priors, or the way I'm predicting probabilities based on one (or both?) model(s)?

If anyone can offer any clarifications/suggestions, I'd be grateful. (Maybe Thierry figured this out?)

Cheers,
Malcolm
#
Hi Malcolm,

Your way of obtaining the predicted probability of falling into a  
class from the MCMCglmm output is correct.  The method you use for the  
clmm output is not the expected value over random effects (as you've  
calculated for the MCMCglmm model), but the expected value for a  
random effect of zero.  If you use probit link in clmm, and  
marginalise the random effects you will find the clmm and MCMCglmm  
estimates to be identical:

summary(fm2 <- clmm2(rating ~ temp + contact, random=judge, data=wine,  
Hess=TRUE, nAGQ=10, link="probit"))

diff(pnorm(c(-Inf,fm2$Theta, Inf) - fm2$beta %*% c(0,0), 0,  
sqrt(1+fm2$stDev)))
diff(pnorm(c(-Inf,fm2$Theta, Inf) - fm2$beta %*% c(1,1), 0,  
sqrt(1+fm2$stDev))) # for tempwarm and contactyes

Cheers,

Jarrod






Quoting Malcolm Fairbrother <m.fairbrother at bristol.ac.uk> on Mon, 7  
Jan 2013 19:56:20 +0000:

  
    
#
Dear Jarrod,

Thanks a lot for this -- very helpful.

OK, so since I DO want to marginalise the random effects (I'm interested in predicted probabilities for a hypothetical/typical judge rather than an actually observed one), I think the code I want is:

diff(pnorm(c(-Inf, 0, colMeans(MC1$CP), Inf)-colMeans(MC1$Sol) %*% c(1,0,0), 0, sqrt(1+1))) # MCMCglmm
diff(pnorm(c(-Inf,fm2$Theta, Inf) - fm2$beta %*% c(0,0), 0, 1)) # clmm

And these two approaches do indeed yield very consistent results. I guess I need to set slightly different SDs for pnorm because clmm assumes the residual variance is 0, whereas with MCMCglmm (and given the prior I used, as recommended in the CourseNotes) it's set to 1?

Much appreciated,
Malcolm
On 7 Jan 2013, at 21:07, Jarrod Hadfield wrote:

            
#
Hi Malcolm,


That makes sense. The next version of MCMCglmm will have a  
family="threshold" that fits a probit link but allowing the `extra'  
residual component to be set to zero. Its not that useful for  
univariate analyses, but for multivariate analyses it will allow  
(polychoric) residual correlations greater in magnitude. Currently  
they are limited to <0.5 (if the residual variance is fixed at one,  
more if it is fixed higher).

Cheers,

Jarrod




Quoting Malcolm Fairbrother <m.fairbrother at bristol.ac.uk> on Tue, 8  
Jan 2013 00:35:24 +0000: