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

Re: standard errors of average marginal effects

Posted: 29 Apr 2025, 20:41
by caldeiraga
Hi Stephane,

I'm currently working on a paper where we estimated a multivariate ordered logit model with three dependent variables, using the mvord package instead of apollo. We are in the process of revising the paper for a journal, and one of the reviewers has requested confidence intervals for the elasticities of the model.

I attended your course in Leeds in 2022 and have searched through various choice modeling manuals, handbooks, and papers, but I haven't found any discussion on this topic. I'd like to know how to compute the standard error for the elasticities of this model. From the discussions here, I understand that I need to compute the probabilities multiple times using different seeds and then calculate the standard error as SE = Std/sqrt(n). Is this correct? Could you point me to any references or examples that could help?

Thank you in advance!

Best, Gabriel

Re: standard errors of average marginal effects

Posted: 19 May 2025, 18:59
by stephanehess
Hi

in apollo, you would just run predictions with the runs setting which would take draws of the estimates using the MLE and the asymptotic variance-covariance matrix. WIth the package you're using, you would I guess have to programme that process manually

Stephane