Important: Read this before posting to this forum

  1. This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
  2. There is a very detailed manual for Apollo available at http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.

WTP for mixed logit with random parameters

Ask questions about post-estimation functions (e.g. prediction, conditionals, etc) or other processing of results.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: WTP for mixed logit with random parameters

Post by stephanehess »

Hi Julia

regarding normal distributions, while they are the default in many applications, this should not be the case. There are very few cases where a normal distribution really makes behavioural senses as it implies a symmetrical and unbounded distribution of sensitivities.

The confusion you have below arises from the difference between population level heterogeneity (which is what the sd of the randomly distributed parameters relates to) and parameter uncertainty (which is what the standard errors relate to). Those are two different things.

What is is that you're after exactly? Moments of WTP with associated standard errors, or a distribute of the WTP with an associated confidence interval around the distribution itself?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
JuliavB
Posts: 42
Joined: 18 Aug 2021, 13:36

Re: WTP for mixed logit with random parameters

Post by JuliavB »

Hi Stephane,

thank you for your reply.
1. So, in order to choose the right type of distribution should I try for different distributions in the code and take a look at the outputs or can also the visualization of conditionals with a code like this be helpful to get an indication which distribution is the right one?

ggplot(conditionals$b_HoeheEEE, aes(x = post.mean)) +
geom_histogram(aes(y = ..count.. / (sum(..count..) * 0.3)), binwidth = 0.01, fill="#69b3a2", color="#e9ecef", alpha=0.9) +
scale_y_continuous(labels = scales::percent) +
geom_density(fill="#69b3a2", color="#e9ecef", alpha=0.6) +
labs(title ="Histogramm and kernel density estimate", x = "Utility", y = "Relative frequency [%]")

2. Just in case that I assume A2 and A3 being normally distributed I can use the below code to calculate the WTP and its. s.e., can`t I? And this is what you refer to as the moments of WTP with associated standard errors (to report parameter uncertainty)?

deltaMethod_settings=list(expression=c(WTP_A2="(mu_A2/b_price)", WTP_A3="(mu_A3/b_price)"))
apollo_deltaMethod(model, deltaMethod_settings)

And when I do not assume normal distribution I can only get the expected value of the WTP via below code? And this is what you refer to as WTP with an associated confidence interval around the distribution itself (to illustrate population level heterogeneity)?

> ### Simulating expected value of WTP for A2
> un <- apollo_unconditionals(model, apollo_probabilities, apollo_inputs)
Unconditional distributions computed
> mean(un$b_HoeheEEE/model$estimate["b_Beitr"])
[1] 0.4087403
> sd(un$b_HoeheEEE/model$estimate["b_Beitr"])
[1] 0.3404505

Would be of great help if you could confirm my above conclusions.

Thanks,
J.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: WTP for mixed logit with random parameters

Post by stephanehess »

Hi

I wouldn't use conditionals for this purpose. They do not show you the true distribution in any way as it still all depends on the sample level distribution you have used. I suggest you pick a distribution that is in line with your behavioural assumptions

If your cost coefficient is fixed, then you can indeed use the calculations you propose below, but can you really expect that to be the case. I would suggest you try a model with a negative lognormal for cost, for example

The delta method calculation indeed relates to parameter uncertainty, while the calculations with the unconditionals relates to heterogeneity

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
JuliavB
Posts: 42
Joined: 18 Aug 2021, 13:36

Re: WTP for mixed logit with random parameters

Post by JuliavB »

Hi Stephane,

thank you for your quick reply.
So if I assume A2 and A3 being normally distributed I can use the below code to calculate the WTP and its. s.e.:

deltaMethod_settings=list(expression=c(WTP_A2="(mu_A2/b_price)", WTP_A3="(mu_A3/b_price)"))
apollo_deltaMethod(model, deltaMethod_settings)

And if I do not assume normal distribution for A2 I can only get the expected value of the WTP via this code:

> ### Simulating expected value of WTP for A2
> un <- apollo_unconditionals(model, apollo_probabilities, apollo_inputs)
Unconditional distributions computed
> mean(un$b_HoeheEEE/model$estimate["b_Beitr"])
[1] 0.4087403
> sd(un$b_HoeheEEE/model$estimate["b_Beitr"])
[1] 0.3404505

Thanks and best,
Julia
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: WTP for mixed logit with random parameters

Post by stephanehess »

Julia

the delta method one gives you the mean of the WTP, and its se. The other calculation gives you the mean and the sd of WTP in the population

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
JuliavB
Posts: 42
Joined: 18 Aug 2021, 13:36

Re: WTP for mixed logit with random parameters

Post by JuliavB »

Yes, the calculations give different information.
So it does not matter what distribution is assumed for A2 and A3 - as long as the price parameter is fixed I can use both calculations as they give different insights into my data?
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: WTP for mixed logit with random parameters

Post by stephanehess »

Well, the whole point of having random heterogeneity would be that you want to know about the distribution of wtp too, so from that perspective, youl want to know not just about the mean. but of course, standard errors are important too as they tell you about the precision of your estimates. But you should then do that not just for the mean
--------------------------------
Stephane Hess
www.stephanehess.me.uk
JuliavB
Posts: 42
Joined: 18 Aug 2021, 13:36

Re: WTP for mixed logit with random parameters

Post by JuliavB »

Thank you very much for your response.

So, if I have fixed price parameter and normally distributed A2 and A3:
1. the delta method calculation below gives me the mean of the WTP and its se (relating to parameter uncertainty):
deltaMethod_settings=list(expression=c(WTP_A2="(mu_A2/b_price)", WTP_A3="(mu_A3/b_price)"))
apollo_deltaMethod(model, deltaMethod_settings)

2. The other calculation below gives me the mean and the sd of WTP in the population (relating to heterogeneity) and thereby simulating the expected value of WTP for A2:
> ### Simulating expected value of WTP for A2
> un <- apollo_unconditionals(model, apollo_probabilities, apollo_inputs)
Unconditional distributions computed
> mean_II(un$b_A2/model$estimate["b_price"])
[1] 0.4087403
> sd(un$b_A2/model$estimate["b_price"])
[1] 0.3404505

Are the above definitions correctly assigned to the two calculations?

And how can the precision of estimates be calculated for the second calculation? Somehow like this: I did not find any example on this in the manual:
deltaMethod_settings=list(expression=c(WTP_A2="(mean_II/b_price)")
apollo_deltaMethod(model, deltaMethod_settings)

Thanks for your support.
Best,
J.
Last edited by JuliavB on 24 Jul 2023, 13:06, edited 1 time in total.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: WTP for mixed logit with random parameters

Post by stephanehess »

Hi

if your cost coefficient is fixed, then there is no need for approach 2 as it should give you the same results as approach 1. And then you can also use approach 1 on the standard deviation estimate, so sig_A2/b_price

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
JuliavB
Posts: 42
Joined: 18 Aug 2021, 13:36

Re: WTP for mixed logit with random parameters

Post by JuliavB »

I am not sure if there is a misunderstanding on my side:
1. So, if my price coefficient b_price is fixed and A2 coefficient is normally or lognormally distributed random I would only use approach 1 to calaculte the WTP for A2?

And to get the parameter uncertainty of the standard deviation I will use below code:
deltaMethod_settings=list(expression=c(WTP_sd_A2="(sig_A2/b_price)")
apollo_deltaMethod(model, deltaMethod_settings)

But how can the result of this calculation be interpreted, as it is not the WTP for A2? Is it just the uncertainty of the standard deviation of the WTP?

2. And if the price parameter and the A2 parameter both are random lognormally distributed, I need to use the following calculation as there is no b_price but only mu_price anymore due to the randomness of the price parameter?

> ### Simulating expected value of WTP for A2
> un <- apollo_unconditionals(model, apollo_probabilities, apollo_inputs)
Unconditional distributions computed
> mean_II(un$b_A2/model$estimate["mu_price"])
> sd(un$b_A2/model$estimate["mu_price"])
Post Reply