ordsup | R Documentation |
Ordinal superiority measures for the linear model and cumulative link models: the probability that an observation from one distribution falls above an independent observation from the other distribution, adjusted for explanatory variables in a model.
ordsup(object, ...)
ordsup.vglm(object, all.vars = FALSE, confint = FALSE, ...)
object |
A |
all.vars |
Logical. The default is to use explanatory variables
which are binary, but all variables are used (except the intercept)
if set to |
confint |
Logical.
If |
... |
Parameters that can be fed into |
Details are given in Agresti and Kateri (2017) and this help
file draws directly from this.
This function returns two quantities for comparing two groups
on an ordinal categorical response variable, while adjusting
for other explanatory variables.
They are called “ordinal superiority” measures, and
the two groups can be compared without supplementary
explanatory variables.
Let Y_1
and Y_2
be independent random
variables from groups A and B, say, for a quantitative ordinal
categorical scale. Then
\Delta = P(Y_1 > Y_2) -
P(Y_2 > Y_1)
summarizes their relative size.
A second quantity is
\gamma = P(Y_1 > Y_2) -
0.5 \times P(Y_2 = Y_1)
.
Then \Delta=2 \times \gamma - 1
.
whereas \gamma=(\Delta + 1)/2
.
The range of \gamma
is [0, 1]
, while
the range of \Delta
is [-1, 1]
.
The examples below are based on that paper.
This function is currently implemented for a very limited
number of specific models.
By default,
a list with components
gamma
and
Delta
,
where each is a vector with elements corresponding to
binary explanatory variables (i.e., 0 or 1),
and if no explanatory variables are binary then a
NULL
is returned.
If confint = TRUE
then the list contains 4 more components:
lower.gamma
,
upper.gamma
,
Lower.Delta
,
Upper.Delta
.
Thomas W. Yee
Agresti, A. and Kateri, M. (2017). Ordinal probability effect measures for group comparisons in multinomial cumulative link models. Biometrics, 73, 214–219.
cumulative
,
propodds
,
uninormal
.
## Not run:
Mental <- read.table("http://www.stat.ufl.edu/~aa/glm/data/Mental.dat",
header = TRUE) # Make take a while to load in
Mental$impair <- ordered(Mental$impair)
pfit3 <- vglm(impair ~ ses + life, data = Mental,
cumulative(link = "probitlink", reverse = FALSE, parallel = TRUE))
coef(pfit3, matrix = TRUE)
ordsup(pfit3) # The 'ses' variable is binary
# Fit a crude LM
fit7 <- vglm(as.numeric(impair) ~ ses + life, uninormal, data = Mental)
coef(fit7, matrix = TRUE) # 'sd' is estimated by MLE
ordsup(fit7)
ordsup(fit7, all.vars = TRUE) # Some output may not be meaningful
ordsup(fit7, confint = TRUE, method = "profile")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.