
Fits a logistic or probit regression model to an ordered factor response. The default logistic case is proportional odds logistic regression, after which the function is named.
polr(formula, data, weights, start, ..., subset, na.action,
contrasts = NULL, Hess = FALSE, model = TRUE,
method = c("logistic", "probit", "loglog", "cloglog", "cauchit"))
A object of class "polr"
. This has components
the coefficients of the linear predictor, which has no intercept.
the intercepts for the class boundaries.
the residual deviance.
a matrix, with a column for each level of the response.
the names of the response levels.
the terms
structure describing the model.
the number of residual degrees of freedoms, calculated using the weights.
the (effective) number of degrees of freedom used by the model
the (effective) number of observations, calculated using the
weights. (nobs
is for use by stepAIC
.
the matched call.
the matched method used.
the convergence code returned by optim
.
the number of function and gradient evaluations used by
optim
.
the linear predictor (including any offset).
(if Hess
is true). Note that this is a
numerical approximation derived from the optimization proces.
(if model
is true).
a formula expression as for regression models, of the form
response ~ predictors
. The response should be a factor
(preferably an ordered factor), which will be interpreted as an
ordinal response, with levels ordered as in the factor.
The model must have an intercept: attempts to remove one will
lead to a warning and be ignored. An offset may be used. See the
documentation of formula
for other details.
an optional data frame, list or environment in which to interpret
the variables occurring in formula
.
optional case weights in fitting. Default to 1.
initial values for the parameters. This is in the format
c(coefficients, zeta)
: see the Values section.
additional arguments to be passed to optim
, most often a
control
argument.
expression saying which subset of the rows of the data should be used in the fit. All observations are included by default.
a function to filter missing data.
a list of contrasts to be used for some or all of the factors appearing as variables in the model formula.
logical for whether the Hessian (the observed information matrix)
should be returned. Use this if you intend to call summary
or
vcov
on the fit.
logical for whether the model matrix should be returned.
logistic or probit or (complementary) log-log or cauchit (corresponding to a Cauchy latent variable).
This model is what Agresti (2002) calls a cumulative link
model. The basic interpretation is as a coarsened version of a
latent variable beta
).
In the logistic case, the left-hand side of the last display is the
log odds of category
The log-log and complementary log-log links are the increasing functions
A proportional hazards model for grouped survival times can be obtained by using the complementary log-log link with grouping ordered by increasing times.
predict
, summary
, vcov
,
anova
, model.frame
and an
extractAIC
method for use with stepAIC
(and
step
). There are also profile
and
confint
methods.
Agresti, A. (2002) Categorical Data. Second edition. Wiley.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
house.plr
summary(house.plr, digits = 3)
## slightly worse fit from
summary(update(house.plr, method = "probit", Hess = TRUE), digits = 3)
## although it is not really appropriate, can fit
summary(update(house.plr, method = "loglog", Hess = TRUE), digits = 3)
summary(update(house.plr, method = "cloglog", Hess = TRUE), digits = 3)
predict(house.plr, housing, type = "p")
addterm(house.plr, ~.^2, test = "Chisq")
house.plr2 <- stepAIC(house.plr, ~.^2)
house.plr2$anova
anova(house.plr, house.plr2)
house.plr <- update(house.plr, Hess=TRUE)
pr <- profile(house.plr)
confint(pr)
plot(pr)
pairs(pr)
Run the code above in your browser using DataLab