Page 1 of 1

Estimating the average marginal effects of a mixed logit within Apollo's post-estimation functions?

Posted: 21 May 2020, 22:47
by BrennaLynn
Hello,

I was hoping for some guidance in estimating average marginal effects for the coefficients of a mixed logit. I was able to follow the instructions in the manual and a few of the posted examples to estimate average marginal effects for a multinomial logit, but am unable to determine how to apply Apollo's post-estimation functions to estimate the AMEs of a mixed logit.

The Procedure:
For each parameter, I will need to define the distribution of the respective betas according to the regression outputs (i.e., using the estimated mean and standard deviation) then draw N betas from said distribution. For each beta, I would use the apollo_predict function to find base predictions. Then, I would marginally increase the data and use apollo_predict again to find new predictions. I would use those two predictions (base and new) to calculate the AME, then take the arithmetic mean of those estimates across all N draws. Rinse and repeat for each mixed coefficient.

My questions are as follows:

(1) apollo_predict reads in the model in order to generate predictions, but I need to draw from the distributions of the betas. Is it possible to define a distribution for each beta and replace the betas in the original model for each draw or iteration? If so, how? If not, is there a better way to accomplish this?

(2) This procedure will only generate point estimates for the AMEs, but I want to be able to say something about the simulation error. Is there a good way to estimate the confidence intervals around AME estimates within Apollo?

Thank you for your time,

Brenna

Re: Estimating the average marginal effects of a mixed logit within Apollo's post-estimation functions?

Posted: 23 May 2020, 21:07
by stephanehess
Hi Brenna

apollo_prediction makes use of the full distribution of the random coefficients. So it will take the estimated parameters and create draws for the coefficients at the person level, using the number of draws you specified in the settings for draws. It will then calculate the probabilities with each draw and average over the draws. That's how to make predictions using Mixed Logit. The output that Apollo produces is averaged across the draws.

To answer your second question, you need to be quite careful here in terms of interpretation. I don't believe simulation error is the right thought here. That would relate to how good or bad the simulation based approximation to the MMNL integral is. What I believe you are meaning is the heterogeneity in the predictions resulting from the random heterogeneity that your MMNL model has estimated.

What you can do in Apollo is to, after estimation, make the following call:

predictions_1=apollo_probabilities(model$estimate,apollo_inputs, functionality="raw")

this will given you the probabilities for each observation at the level of each draw.

If you then want to make a second set of predictions after changing the attributes, please make sure to follow the below procedure. Imagine you're looking at a 1% increase in the cost of the first alternative, called cost_1. Then you would do:

database$cost_1=1.0.1*database$cost_1

You then need to revalidate your inputs, by calling:

apollo_inputs = apollo_validateInputs()

before

predictions_2=apollo_probabilities(model$estimate,apollo_inputs, functionality="raw")

Best wishes

Stephane

Re: Estimating the average marginal effects of a mixed logit within Apollo's post-estimation functions?

Posted: 26 May 2020, 19:10
by BrennaLynn
Hi Stephane,

Thank you so much for your thorough, clear response. This is a great help!

All the best,
Brenna