Extracts EMMeans (produced by emmeans
) from Cumulative Link (Mixed) Models (produced by clm
or clmm
), with different possible formats.
rating.emmeans(emm, type = c("prob", "cumprob", "class1", "class2"), level = 0.9)
object returned by emmeans
applied on a clm
or clmm
object.
type of output to be returned: "prob"
(default) gives probability of each rating, "cumprob"
gives cumulative probabilities (Pi is probability to be <= to rating i), "class1"
gives the most probable rating and "class2"
gives the first rating for which the cumulative probability is >= to level
.
used only for type "class2"
(see type
).
Maxime HERVE <maxime.herve@univ-rennes1.fr>
A factor named cut
must have been called in emmeans
, to compute EMMeans per cut point (i.e. rating). Additionally, the argument mode
of emmeans
must have been set to "linear.predictor". Finally, the call to emmeans
is typically like emmeans(model,~factor|cut,mode="linear.predictor")
where factor
is the factor (or interaction) giving levels for which EMMeans have to be computed.
emmeans
, clm
, clmm
require(ordinal)
require(emmeans)
model <- clm(rating~contact*temp,data=wine)
EMM <- emmeans(model,~contact:temp|cut,mode="linear.predictor")
# Probabilities
rating.emmeans(EMM)
# Cumulative probabilities
rating.emmeans(EMM,type="cumprob")
# Most probable rating
rating.emmeans(EMM,type="class1")
Run the code above in your browser using DataLab