Does anyone have any suggestions to cross-validate a clmm/clmm2 (ordinal package) model in R? I am a bit of a stats novice so apologies... I assume it could be easy to do with the cvTools package in R by writing a cost function.
Here is some dummy example code (I set k low just for this example). My data is ordinal, uses the logit link, and flexible threshold. In this example I used the cost function from a glm but this is of course wrong. I just don't know what the cost function would be. NOTE the predict function can only be used with clmm2, not clmm.
library(ordinal)
library(cvTools)
dat <- subset(soup, as.numeric(as.character(RESP)) <= 24)
dat$RESP <- dat$RESP[drop=TRUE]
head(dat)
m1 <- clmm2(SURENESS ~ PROD, random = RESP, data = dat, link="probit",
Hess = TRUE, method="ucminf", threshold = "symmetric")
cvFit(m1, data = dat, y = dat$SURENESS,cost= function(r, pi = 0) mean(abs(r-pi) > 0.5), K = 2, R = 10)
warnings()