Solved – Presenting marginal effects of logit with fixed effects

data visualizationfixed-effects-modellogisticlogit

I have a traditional logit model with a dichotomous dependent variable and several independent variables. One of the IVs is categorical and in my R code, I treat it as a factor.

In the past, I've presented marginal effects by creating a simulated dataset in which I hold all variables at their mean or median and then increment the variable of interest over its range. I then use the estimated model to get the predicted probability of a given outcome over the range of the variable of interest. This is then easily plotted to create a nice graphical interpretation of the estimated effect of changes in the variable of interest.

But in the fixed effect case, where one variable in the model is a factor, how does one generate an analogous graph?

Do I need a separate estimated effect graph for each value of the factor variable or is there someway to estimate an average effect of the changes in the variable of interest over all the categories in factor variable while all other variables are held at their mean?

Best Answer

In R the effects package can easily help with interpreting such coefficients by producing the appropriate graphs. From CRAN:

effects: Effect Displays for Linear, Generalized Linear, and Other Models

Graphical and tabular effect displays, e.g., of interactions, for various statistical models with linear predictors.

The package comes with two papers by John Fox describing the use of the package (along with examples) and the underlying implementation. The package takes good care of dealing with the subtle details and implementation difficulties for the supported models.

As an example:

require(car)
require(effects)
data(Cowles)
cowles.mod <- glm(volunteer ~ sex + neuroticism*extraversion,
                  data=Cowles, family=binomial)
Anova(cowles.mod)
plot(effect("neuroticism*extraversion", cowles.mod))
plot(effect("sex", cowles.mod))  ##for dummy, but should be similar for factors

Which will yield:

> Anova(cowles.mod)
Analysis of Deviance Table (Type II tests)

Response: volunteer
                         LR Chisq Df Pr(>Chisq)    
sex                        4.9184  1   0.026572 *  
neuroticism                0.3139  1   0.575316    
extraversion              22.1372  1  2.538e-06 ***
neuroticism:extraversion   8.6213  1   0.003323 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

And for the graph, which displays the predicted values of Y on the vertical axis, and the effect of X ("neuroticism") on Y given various levels of Z ("extraversion"):

enter image description here

Here's the effect plot for the dummy (but it should work similarly for factors):

enter image description here

Lastly, there seems to be some confusion surrounding partial effects (holding other predictors constant) vs marginal effects (ignoring other predictors). In my understanding the effects package is concerned with displaying "partial effects".

Related Question