Debian Codegraph @

man/tidy.polr.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/mass-polr.R
3 \name{tidy.polr}
4 \alias{tidy.polr}
5 \alias{polr_tidiers}
6 \title{Tidy a(n) polr object}
7 \usage{
8 \method{tidy}{polr}(
9 x,
10 conf.int = FALSE,
11 conf.level = 0.95,
12 exponentiate = FALSE,
13 p.values = FALSE,
14 ...
15 )
16 }
17 \arguments{
18 \item{x}{A \code{polr} object returned from \code{\link[MASS:polr]{MASS::polr()}}.}
19
20 \item{conf.int}{Logical indicating whether or not to include a confidence
21 interval in the tidied output. Defaults to \code{FALSE}.}
22
23 \item{conf.level}{The confidence level to use for the confidence interval
24 if \code{conf.int = TRUE}. Must be strictly greater than 0 and less than 1.
25 Defaults to 0.95, which corresponds to a 95 percent confidence interval.}
26
27 \item{exponentiate}{Logical indicating whether or not to exponentiate the
28 the coefficient estimates. This is typical for logistic and multinomial
29 regressions, but a bad idea if there is no log or logit link. Defaults
30 to \code{FALSE}.}
31
32 \item{p.values}{Logical. Should p-values be returned,
33 based on chi-squared tests from \code{\link[MASS:dropterm]{MASS::dropterm()}}. Defaults to FALSE.}
34
35 \item{...}{Additional arguments. Not used. Needed to match generic
36 signature only. \strong{Cautionary note:} Misspelled arguments will be
37 absorbed in \code{...}, where they will be ignored. If the misspelled
38 argument has a default value, the default value will be used.
39 For example, if you pass \code{conf.lvel = 0.9}, all computation will
40 proceed using \code{conf.level = 0.95}. Two exceptions here are:
41 \itemize{
42 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
43 it will be ignored.
44 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
45 will be ignored.
46 }}
47 }
48 \description{
49 Tidy summarizes information about the components of a model.
50 A model component might be a single term in a regression, a single
51 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
52 model component varies across models but is usually self-evident.
53 If a model has several distinct types of components, you will need to
54 specify which components to return.
55 }
56 \details{
57 In \verb{broom 0.7.0} the \code{coefficient_type} column was renamed to
58 \code{coef.type}, and the contents were changed as well. Now the contents
59 are \code{coefficient} and \code{scale}, rather than \code{coefficient} and \code{zeta}.
60
61 Calculating p.values with the \code{dropterm()} function is the approach
62 suggested by the MASS package author. This
63 approach is computationally intensive so that p.values are only
64 returned if requested explicitly. Additionally, it only works for
65 models containing no variables with more than two categories. If this
66 condition is not met, a message is shown and NA is returned instead of
67 p-values.
68 }
69 \examples{
70 \dontshow{if (rlang::is_installed("MASS")) withAutoprint(\{ # examplesIf}
71
72 # load libraries for models and data
73 library(MASS)
74
75 # fit model
76 fit <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
77
78 # summarize model fit with tidiers
79 tidy(fit, exponentiate = TRUE, conf.int = TRUE)
80
81 glance(fit)
82 augment(fit, type.predict = "class")
83
84 fit2 <- polr(factor(gear) ~ am + mpg + qsec, data = mtcars)
85
86 tidy(fit, p.values = TRUE)
87 \dontshow{\}) # examplesIf}
88 }
89 \seealso{
90 \link{tidy}, \code{\link[MASS:polr]{MASS::polr()}}
91
92 Other ordinal tidiers:
93 \code{\link{augment.clm}()},
94 \code{\link{augment.polr}()},
95 \code{\link{glance.clm}()},
96 \code{\link{glance.clmm}()},
97 \code{\link{glance.polr}()},
98 \code{\link{glance.svyolr}()},
99 \code{\link{tidy.clm}()},
100 \code{\link{tidy.clmm}()},
101 \code{\link{tidy.svyolr}()}
102 }
103 \concept{ordinal tidiers}
104 \value{
105 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
106 \item{conf.high}{Upper bound on the confidence interval for the estimate.}
107 \item{conf.low}{Lower bound on the confidence interval for the estimate.}
108 \item{estimate}{The estimated value of the regression term.}
109 \item{p.value}{The two-sided p-value associated with the observed statistic.}
110 \item{statistic}{The value of a T-statistic to use in a hypothesis that the regression term is non-zero.}
111 \item{std.error}{The standard error of the regression term.}
112 \item{term}{The name of the regression term.}
113
114 }