Skip to content
Prev 5204 / 20628 Next

help with ordinal MCMCglmm

Hi Achaz,

I think the code below does what you want.

CP <- cbind(-Inf, 0, mod1$CP, Inf)  # Obtain posteior cutpoints

Sol <-mod1$Sol  # Obtain posterior fixed effects (I think there are two?)

VCV<-rowSums(mod1$VCV) # Total variance

prob.with<-mcmc(matrix(NA, 1000,15))
prob.without<-mcmc(matrix(NA, 1000,15))


for (i in 1:15) {
prob.with[,i] <-  pnorm(CP[, i + 1] - Sol[,1], 0, sqrt(VCV + 1)) -  
pnorm(CP[, i] -Sol[,1], 0, sqrt(VCV + 1))
prob.without[,i] <-  pnorm(CP[, i + 1] - Sol[,2], 0, sqrt(VCV + 1)) -  
pnorm(CP[, i] -Sol[,2], 0, sqrt(VCV + 1))
}

Cheers,

Jarrod


Quoting Achaz von Hardenberg <achaz.hardenberg at gmail.com>: