Page 1 of 1

standard errors of average marginal effects

Posted: 04 Apr 2024, 09:47
by marie
Hi,

I would like to estimate standard errors of average marginal effects. I am running a MXL model on a DCE where participants could choose an option between three different contracts (A, B or C).
I estimated average marginal effects following the example http://apollochoicemodelling.com/files/ ... variates.r . I have dummy variables so my code is the following:

### Use the estimated model to make predictions
predictions_base = apollo_prediction(model, apollo_probabilities, apollo_inputs)
### Level change (env_C=1 to env_C=2)
database$env_C = 2
### Rerun predictions with the new data
apollo_inputs = apollo_validateInputs()
predictions_new = apollo_prediction(model, apollo_probabilities, apollo_inputs)
### Return to original data
database$env_C = 1
apollo_inputs = apollo_validateInputs()
### Compute change in probabilities
change=predictions_new-predictions_base
change=change[,-ncol(change)]
change=change[,-c(1,2)]
### Mean of changes to compute average marginal effects
mean(change$contratC)
mean(change$contratA)
mean(change$contratB)

Ideally, I would like to apply the Delta-method to get the estimate standard errors of the average marginal effect. From what I understood from the manual the function apollo_deltaMethod can be apply to model parameters. However, I do not know how to apply the Delta-method to my expression of interest which is change=predictions_new-predictions_base. Is it possible to do it? Do you have any recommendation on the procedure to follow?

Besides, I read in the manual that “In addition, an optional setting called runs has been included that computes standard errors across multiple prediction runs based on different draws from the estimates and covariance matrix for the model parameters”. However, I do not know how to easily access standard errors values? The result retuned by the function do not specify standard errors if I am not mistaken?

Thank you for your help,

Marie

Re: standard errors of average marginal effects

Posted: 22 Apr 2024, 13:36
by stephanehess
Marie

have a look at the help file for apollo_prediction. If you run it with the runs setting, it will produce an array for you with the runs at different draws from the asymptotic parameter distribution and you can then use those to calculate standard errors for your marginal effects

Stephane