These methods tidy the coefficients of ordinal logistic regression models generated by ordinal::clm() or ordinal::clmm() of the ordinal package, MASS::polr() of the MASS packge, or survey::svyolr() of the survey package.

# S3 method for polr
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, ...)

# S3 method for polr
glance(x, ...)

# S3 method for polr
augment(x, data = stats::model.frame(x), newdata = NULL,
  type.predict = c("probs", "class"), ...)

# S3 method for clm
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, conf.type = c("profile",
  "Wald"), ...)

# S3 method for clmm
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, conf.type = c("profile",
  "Wald"), ...)

# S3 method for clm
glance(x, ...)

# S3 method for clmm
glance(x, ...)

# S3 method for clm
augment(x, data = stats::model.frame(x), newdata = NULL,
  type.predict = c("prob", "class"), ...)

# S3 method for svyolr
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, ...)

# S3 method for svyolr
glance(x, ...)

Arguments

x

a model of class clm, clmm, polr or svyolr

conf.int

Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE.

conf.level

The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

exponentiate

Logical indicating whether or not to exponentiate the the coefficient estimates. This is typical for logistic and multinomial regressions, but a bad idea if there is no log or logit link. Defaults to FALSE.

quick

Logical indiciating if the only the term and estimate columns should be returned. Often useful to avoid time consuming covariance and standard error calculations. Defaults to FALSE.

...

extra arguments

data

A data.frame() or tibble::tibble() containing the original data that was used to produce the object x. Defaults to stats::model.frame(x) so that augment(my_fit) returns the augmented original data. Do not pass new data to the data argument. Augment will report information such as influence and cooks distance for data passed to the data argument. These measures are only defined for the original training data.

newdata

A data.frame() or tibble::tibble() containing all the original predictors used to create x. Defaults to NULL, indicating that nothing has been passed to newdata. If newdata is specified, the data argument will be ignored.

type.predict

type of prediction to compute for a CLM; passed on to ordinal::predict.clm() or predict.polr

conf.type

the type of confidence interval (see ordinal::confint.clm())

Value

tidy.clm, tidy.clmm, tidy.polr and tidy.svyolr return one row for each coefficient at each level of the response variable, with six columns:

term

term in the model

estimate

estimated coefficient

std.error

standard error

statistic

z-statistic

p.value

two-sided p-value

coefficient_type

type of coefficient, see ordinal::clm()

If conf.int=TRUE, it also includes columns for conf.low and glance.clm, glance.clmm, glance.polr and glance.svyolr return a one-row data.frame with the columns:
edf

the effective degrees of freedom

logLik

the data's log-likelihood under the model

AIC

the Akaike Information Criterion

BIC

the Bayesian Information Criterion

df.residual

residual degrees of freedom

augment.clm and augment.polr returns one row for each observation, with additional columns added to the original data:
.fitted

fitted values of model

.se.fit

standard errors of fitted values

augment is not supportted for ordinal::clmm() and survey::svyolr() models. All tidying methods return a data.frame without rownames. The structure depends on the method chosen.

Examples

if (require(ordinal)){ clm_mod <- clm(rating ~ temp * contact, data = wine) tidy(clm_mod) tidy(clm_mod, conf.int = TRUE) tidy(clm_mod, conf.int = TRUE, conf.type = "Wald", exponentiate = TRUE) glance(clm_mod) augment(clm_mod) clm_mod2 <- clm(rating ~ temp, nominal = ~ contact, data = wine) tidy(clm_mod2) clmm_mod <- clmm(rating ~ temp + contact + (1 | judge), data = wine) tidy(clmm_mod) glance(clmm_mod) }
#> Loading required package: ordinal
#> #> Attaching package: ‘ordinal’
#> The following object is masked from ‘package:plm’: #> #> ranef
#> The following object is masked from ‘package:dplyr’: #> #> slice
#> # A tibble: 1 x 4 #> edf logLik AIC BIC #> <dbl> <dbl> <dbl> <dbl> #> 1 7 -81.6 177. 193.
if (require(MASS)) { polr_mod <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) tidy(polr_mod, exponentiate = TRUE, conf.int = TRUE) glance(polr_mod) augment(polr_mod, type.predict = "class") }
#> # A tibble: 72 x 6 #> Sat Infl Type Cont X.weights. .fitted #> * <ord> <fct> <fct> <fct> <int> <dbl> #> 1 Low Low Tower Low 21 1 #> 2 Medium Low Tower Low 21 1 #> 3 High Low Tower Low 28 1 #> 4 Low Medium Tower Low 34 3 #> 5 Medium Medium Tower Low 22 3 #> 6 High Medium Tower Low 36 3 #> 7 Low High Tower Low 10 3 #> 8 Medium High Tower Low 11 3 #> 9 High High Tower Low 36 3 #> 10 Low Low Apartment Low 61 1 #> # ... with 62 more rows