Page 1 of 1

Probabilities with standard errors

Posted: 10 Feb 2021, 18:16
by tomas.rossetti
I am estimating a binary choice model where some variables that affect choice probabilities are continuous. I would like to plot how probabilities change with respect to some of these continuous variables, along with a confidence interval that reflects the parameters' uncertainty.

I know that I would have to construct a dataset with a baseline alternative, and another alternative where all attributes are fixed except for the continuous one I would like to plot. Using apollo_mnl will give me the point estimates but not the standard deviations I'm also looking for. That function could give me a confidence interval if I'm estimating a mixed logit model, but that would be introduced through the random heterogeneity and not through the parameters' standard errors.

Is there any way other than sampling from the betas' asymptotic distribution and running apollo_mnl?

Thanks for your help!

Tomás

Re: Probabilities with standard errors

Posted: 11 Feb 2021, 18:28
by dpalma
Hi Tomás,

You can do this in two stages. Let's assume your model has two alternatives, with the following utility functions:

Code: Select all

V[['yes']] = b0 + b1*x1 + b2*x
V[['no']]  = 0
You want to calculate the effect of x1 on the probability, including confidence intervals. You would then:

1) Create a new dataset where only x1 changes, so for example:

Code: Select all

id   x1   x2 choice
 1  0.1  3.0      1
 2  0.2  3.0      1
 3  0.3  3.0      1
 4  0.4  3.0      1
 5  0.5  3.0      1
 6  0.6  3.0      1
...
2) Use apollo_prediction with the option for confidence intervals. This will take multiple sets of draws for b0, b1 and b2 from their asymptotic distribution and calculate predictions for each set. Based on these values, it will calculate a confidence interval. You would do this as follows:

Code: Select all

apolo_inputs <- apollo_validateInputs() # this is to update the database to the new one created in the previous point
pred <- apollo_prediction(model, apollo_probabilities, apollo_inputs, prediction_settings = list(runs=100)) # use 100 draws for C.I.
You can read apollo_prediction documentation for the specifics on how results are returned by apollo_prediction, but the aggregated results will be printed to screen.

Let us know if you run into any issues with this approach.

Cheers
David

Re: Probabilities with standard errors

Posted: 11 Feb 2021, 19:34
by tomas.rossetti
Wonderful, thank you so much David.

All the best,

Tomás