For objects of class polr, it calculates the average change in predicted probabilities, for discrete changes in a covariate holding all other variables at their observed values.

ordChange2(obj, varnames, data, diffchange = c("sd", "unit"), R = 1500)

Arguments

obj

A model object of class polr.

varnames

A vector of strings identifying the variable to be manipulated.

data

Data frame used to fit object.

diffchange

A string indicating the difference in predictor values to calculate the discrete change. sd gives plus and minus one-half standard deviation change around the median and unit gives a plus and minus one-half unit change around the median.

R

Number of simulations.

Value

A list with the following elements:

diffs

A matrix of calculated first differences

minmax

A matrix of values that were used to calculate the predicted changes

minPred

A matrix of predicted probabilities when each variable is held at its minimum value, in turn.

maxPred

A matrix of predicted probabilities when each variable is held at its maximum value, in turn.

Details

The function calculates the changes in predicted probabilities for maximal discrete changes in the covariates for objects of class polr. This function works with polynomials specified with the poly function. It also works with multiplicative interactions of the covariates by virtue of the fact that it holds all other variables at typical values. By default, typical values are the median for quantitative variables and the mode for factors. The way the function works with factors is a bit different. The function identifies the two most different levels of the factor and calculates the change in predictions for a change from the level with the smallest prediction to the level with the largest prediction.

Examples

library(MASS) data(france) polr.mod <- polr(vote ~ age + male + retnat + lrself, data=france) typical.france <- data.frame( age = 35, retnat = factor(1, levels=1:3, labels=levels(france$retnat)) ) ordChange2(polr.mod, "age", data=france, diffchange="sd")
#> #> Re-fitting to get Hessian
#> PCF PS Green RPR UDF #> age -0.011* -0.014 0.001 0.007 0.016*