polr {MASS} | R Documentation |
Proportional Odds Logistic Regression
Description
Fits a proportional odd logistic regression model to an ordered factor
response.
Usage
polr(formula, data = NULL, weights, start, ..., subset,
na.action = na.fail, contrasts = NULL, Hess = FALSE)
Arguments
formula |
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. A proportional odds model will be
fitted. 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.
|
data |
an optional data frame in which to interpret the variables occurring
in formula .
|
weights |
optional case weights in fitting. Default to 1.
|
start |
initial values for the parameters.
|
... |
additional arguments to be passed to optim , most often a
control argument.
|
subset |
expression saying which subset of the rows of the data should be used
in the fit. All observations are included by default.
|
na.action |
a function to filter missing data.
|
contrasts |
a list of contrasts to be used for some or all of
the factors appearing as variables in the model formula.
|
Hess |
logical for whether the Hessian (the observed information matrix)
should be returned.
|
Value
A object of class "polr"
.
coefficients |
the coefficients of the linear predictor.
|
zeta |
the intercepts for the class boundaries.
|
deviance |
the residual deviance.
|
fitted.values |
a matrix, with a column for each level of the response.
|
lev |
the names of the response levels.
|
terms |
the terms structure describing the model.
|
df.residual |
the number of residual degrees of freedoms, calculated using the weights.
|
edf |
the (effective) number of degrees of freedom used by the model
|
n |
the (effective) number of observations, calculated using the weights
|
call |
the matched call.
|
convergence |
the convergence code returned by optim .
|
niter |
the number of function and gradient evaluations used by optim .
|
Hessian |
(if Hess is true).
|
See Also
optim
, glm
, multinom
.
Examples
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
house.plr
summary(house.plr)
predict(house.plr, housing, type = "p")
addterm(house.plr, ~.^2, test = "Chisq")
house.plr2 <- stepAIC(house.plr, ~.^2)
house.plr2$anova