0

I am currently working testing the effects of aid on inequality. I am using panel data, and the model looks something like the following:

Model<- lm(Gini ~  Aid   + log(GDP.capita)  + polity2 + 
            GovtConsumption +Country + Year,
                             data = main.df)

or

Model<- plm(Gini ~  Aid   + log(GDP.capita) + Growth + polity2 +GovtConsumption, 
                             data = main.df, effect =  "twoways", model = "within")

I now have my coefficient estimates, and would like to show the average effect of increasing aid by x amount, to illustrate the substantive meaning of my model. To do this, I'd like to hold all of the other explanatory variables at their mean value, and then vary the value of the aid variable.

e.g. to predict the outcome (inequality) when aid = 10

 predict(Model, newdata = data.frame(Aid= 10, GDP.capita 
        =mean(data$GDP.capita), Growth = mean(data$Growth), polity2 = 
        mean(data$polity2), GovtConsumption = mean(data$GovtConsumption), 
        Country = "??" , Year= "??"))

However, because it is a fixed effect model, I do not know what value to input for the "mean" fixed effect (see question marks above). I don't want the prediction to be for any specific country, but rather the overall average effect - is it possible to do this?

Many thanks in advance

M

Matt H
  • 1
  • 3
  • If I understand you correctly, you want to compute the marginal effect at the means. In a linear model, the marginal effect at the means of the independent variables is equal to the mean of the predicted values. So, simply predict for all observations and then take the mean. – mloning Aug 21 '18 at 06:27
  • Hi there, and thanks for your response. I'd like to compute the predicted effect of an increase in one independent variable, holding all others at their mean. so for example If I wanted to see what the effect of an increase in aid from 10 to 20 would be, I would predict the above formula with aid = 10 and aid = 20 and calculate the difference between the predicted values of the independent variable. The problem is that with a fixed effects model, the new data frame included needs to include a value for Country and Year (the fixed effects). I do not know what values to put for these ... – Matt H Aug 21 '18 at 08:20

2 Answers2

2

One option would be to pick specific countries and years for substantive reasons. Maybe there are historical cases that subject-matter experts consider especially representative or salient, or maybe your analysis focuses on particular cases, and you'd like to see what your model suggests about the marginal effects of aid in those cases.

Another option would be to redo the analysis with a multilevel (or mixed or hierarchical) model with crossed effects for countries and years. This approach would allow you to extract estimates for the generic effect of aid while also accounting for country- and year-specific variations in that effect. For an overview of R functionality for mixed models, check out the CRAN Task View for that topic (here). And for a nice explanation of crossed effects and how to implement them in R, see this Cross Validated Q&A. If you go the mixed-effects route, you'll want to think carefully about whether the slopes of certain effects (including aid) might vary across countries as well, and whether there might be interactions between some of the covariates.

No matter which design you choose, you may want to think about how selection bias could be affecting the results, and how to handle that.

ulfelder
  • 485
  • 3
  • 12
1

You seem to be looking for the marginal effect of aid. In a linear model, this is what the estimated coefficient tells you. Equivalently, you could predict using all values rather than just the mean of the independent variables, so using the estimated coefficients and fixed effects and the values from all independent variables with aid being set to 10, then take the average of the predicted values and compare this with the average of predicted values when aid is set to 20.

But this is what the estimated coefficient of aid tells you already in a linear model, as it gives you the average effect of increasing aid by one unit while holding all other variables constant, so multiplying your estimated aid coefficient by the change in aid would give you the same result.

mloning
  • 408
  • 4
  • 12