Last data update: 2014.03.03

R: Plot Average Effects of Variables in Proportional Odds...
ordAveEffPlotR Documentation

Plot Average Effects of Variables in Proportional Odds Logistic Regression

Description

For objects of class polr the function plots the average effect of a single variable holding all other variables at their observed values.

Usage

ordAveEffPlot(obj, varname, data, R = 1500, nvals = 25, plot = TRUE, ...)

Arguments

obj

An object of class polr

varname

A string providing the name of the variable for which you want the plot to be drawn.

data

Data used to estimate obj.

R

Number of simulations to generate confidence intervals.

nvals

Number of evaluation points of the function

plot

Logical indicating whether or not the result should be plotted (if TRUE) or returned to the console (if FALSE).

...

Arguments passed down to the call to xyplot

Details

Following the advice of Hanmer and Kalkan (2013) the function calculates the average effect of a variable holding all other variables at observed values and then plots the result.

Value

Either a plot or a data frame with variables

mean

The average effect (i.e., predicted probability)

lower

The lower 95% confidence bound

upper

The upper 95% confidence bound

y

The values of the dependent variable being predicted

x

The values of the independent variable being manipulated

Author(s)

Dave Armstrong (UW-Milwaukee, Department of Political Science)

References

Hanmer, M.J. and K.O. Kalkan. 2013. ‘Behind the Curve: Clarifying the Best Approach to Calculating Predicted Probabilities and Marginal Effects from Limited Dependent Variable Models’. American Journal of Political Science. 57(1): 263-277.

Examples

library(MASS)
data(france)
polr.mod <- polr(vote ~ age + male + retnat + lrself, data=france)
## Not run: ordAveEffPlot(polr.mod, "lrself", data=france)	

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DAMisc)
Loading required package: car
Loading required package: effects

Attaching package: 'effects'

The following object is masked from 'package:car':

    Prestige

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DAMisc/ordAveEffPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ordAveEffPlot
> ### Title: Plot Average Effects of Variables in Proportional Odds Logistic
> ###   Regression
> ### Aliases: ordAveEffPlot
> 
> ### ** Examples
> 
> library(MASS)
> data(france)
> polr.mod <- polr(vote ~ age + male + retnat + lrself, data=france)
> ## Not run: ordAveEffPlot(polr.mod, "lrself", data=france)	
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>