polr_std: polr() with standardised continuous variables

polr_stdR Documentation

polr() with standardised continuous variables

Description

This runs MASS::polr() after standardising all continuous predictors, while leaving factors intact. Note that the Hessian (the observed information matrix) is always returned, so that the Hess argument cannot be used.

Usage

polr_std(formula, data = NULL, weights = NULL, ...)

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. 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, list or environment in which to interpret the variables occurring in formula.

weights

optional case weights in fitting. Default to 1.

...

Arguments passed on to MASS::polr

start

initial values for the parameters. This is in the format c(coefficients, zeta): see the Values section.

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.

model

logical for whether the model matrix should be returned.

method

logistic or probit or (complementary) log-log or cauchit (corresponding to a Cauchy latent variable).

Details

In the model call, the weights variable will always be called .weights. This might pose a problem when you update the model later on, for the moment the only workaround is to rename the weights variable accordingly (or to fix it and contribute a PR on Github).

References

See (Fox, 2015) for an argument why dummy variables should never be standardised.

Examples

polr_std(poverty ~ religion + age + gender, WVS)

LukasWallrich/timesaveR documentation built on Nov. 29, 2024, 4:47 a.m.