# plot predicted values from a cumulative link model (clm, ordinal)

Which is the best way to visualize (plot) the predicted values (and relative 95% confidence intervals) from a cumulative link model fitted with the function clm() from the R package ordinal?

The model has this simple form:

ORDINAL_response ~ clm(continuous_predictor)


The functionpredict() gives a probability (and relative CI) for each of the value of the ordinal response. I am a bit confused about that...

I want just to visualize the predicted relationship between the ordinal response variable and the continuous predictor.

As in a logistic regression, the response variable of a cumulative link model is not the ORDINAL_response variable, but the probability that the ORDINAL_response variable will be below each of its possible levels. Plotting predicted values of the ORDINAL_response variable is thus impossible and does not make much sense: it is an ordinal variable, a type of qualitative variable, so it cannot take any numerical value (although the levels can be labelled with numbers), and any values between the levels are not meaningful. To understand this last point, replace the numbers with which you labelled your levels by words such as "not at all", "very little", "a little", "a fair amount", "a lot", "all" (for 6 levels).

In your situation, you could either plot the probability of each levels for each value of the continuous variable, or plot the most probable level for each value of the continuous variable.

For the first option (here the example is for a five level ordinal response):

p <- predict(model, newdata = data.frame(continuous_predictor = sort(continuous_predictor)), type = "prob", interval = TRUE)
plot(sort(continuous_predictor),p$$fit[,1], type = "l") lines(sort(continuous_predictor),p$$lwr[,1], col = "red")
lines(sort(continuous_predictor),p$$upr[,1], col = "red") for (i in 2:5){ lines(sort(continuous_predictor),pfit[,i], lty = i) lines(sort(continuous_predictor),plwr[,i], lty = i, col = "red") lines(sort(continuous_predictor),p$$upr[,i], lty = i, col = "red")
}


You can of course remove the confidence intervals if the graph is difficult to read, or plot the predicted probability for each level on a separate graph.

For the second option, after calculating the predicted probabilities as in the previous example:

most.probable <- apply(p$fit, 1, which.max) plot(sort(continuous_predictor),most.probable)  In the limit case where your variable is not really an ordinal variable but rather a discrete numerical variable (that is, there is always the same difference between successive levels, proportionality holds such that level 4 really represent twice as much as level 2, and calculating an average between different levels is meaningful), then you can calculate the statistical expected value for each value of the independent variable: expected <- p$fit %*% 1:5
plot(sort(continuous_predictor), expected)