Page 1 of 3

WTP for mixed logit with random parameters

Posted: 23 Feb 2023, 14:51
by JuliavB
Dear Stephane,

I have a question on the calculation of willingness to pay in mixed logit:

Is it appropriate to randomise the price attribute as well as the other two attributes of my experiment AND then use the random parameter averages to calculate the WTP (mu_Attribute/mu_price)?
I am not sure if it might make more sense to not randomise the price due to the fact that it might be imprecise to devide randomised parameter by randomised parameter (even if the sigma of the price is significant and therefore indicates that there is heterogeneity in price).

Could you give any insights on this?

Thank you in advance and best wishes,
J.

Re: WTP for mixed logit with random parameters

Posted: 27 Feb 2023, 13:22
by stephanehess
The cost coefficient is quite likely to be the one with the most heterogeneity in the population, so you should definitely test for such heterogeneity.

But you would never calculate WTP as the ratio of the means - you need the full distribution

Please have a look at https://doi.org/10.1007/s11116-011-9331-3

Re: WTP for mixed logit with random parameters

Posted: 02 Mar 2023, 12:09
by JuliavB
Thank you very much for clarifying.
So, if I assume my cost coefficient being lognomally distributed and the other coefficients being normally distributed - so all three coefficients being random I have two options:
1. Estimating the model in WTP space to directly get the WTP values
2. Estimating the model in preference space and then using bootstrap method to manually average the WTP results of bootstrap estimations in order to get WTP for whole sample? And if yes, is there any specific example provided on how to do that code-wise in apollo?

Thank you very much in advance!

Re: WTP for mixed logit with random parameters

Posted: 02 Mar 2023, 12:23
by JuliavB
Two more things just to be sure:
1. If my cost coefficient is lognormally distributed (the only random coefficient in my model) and the other attributes are dummy coded and therefore fixed coefficients, the WTP can be computed via delta method like b_A2/mu_cost or is there also other approach needed?
2. In latent class models the WTP can be calculated via delta method just that it is calculated separately for each class via b_A2_class_a/b_cost_class_a and b_A2_class_b/b_cost_class_b, right?

Thank you in advance!

Re: WTP for mixed logit with random parameters

Posted: 06 Mar 2023, 07:18
by stephanehess
Hi

replying to your two posts at the same time.
So, if I assume my cost coefficient being lognomally distributed and the other coefficients being normally distributed - so all three coefficients being random I have two options:
1. Estimating the model in WTP space to directly get the WTP values
Working in WTP space will always give you the WTP directly, as long as your cost coefficient enters the utility in a linear way.
Estimating the model in preference space and then using bootstrap method to manually average the WTP results of bootstrap estimations in order to get WTP for whole sample? And if yes, is there any specific example provided on how to do that code-wise in apollo?
Bootstrapping is not the answer here. But maybe you don't mean bootstrapping but simulation of the ratio? This is only possible if the inverse moments exist - see http://www.stephanehess.me.uk/papers/jo ... n_2012.pdf

It's easy to get the full distribution in Apollo using apollo_unconditionals
If my cost coefficient is lognormally distributed (the only random coefficient in my model) and the other attributes are dummy coded and therefore fixed coefficients, the WTP can be computed via delta method like b_A2/mu_cost or is there also other approach needed?
No, this is not correct. Mu is the mean of the distribution of the log of the coefficient. You need to divide b_A2 by the full distribution, using simulation. It's easy to get the full distribution in Apollo using apollo_unconditionals
In latent class models the WTP can be calculated via delta method just that it is calculated separately for each class via b_A2_class_a/b_cost_class_a and b_A2_class_b/b_cost_class_b, right?
You don't need the delta method for the calculation of the wtp, only for the standard errors thereof. But your calculation above is correct, but you then still need to take the weighted average across classes.

Hope this helps

Stephane

Re: WTP for mixed logit with random parameters

Posted: 10 Mar 2023, 10:31
by JuliavB
Hi Stephane,

your information helped a lot. Thank you very much.
Bootstrapping is not the answer here. But maybe you don't mean bootstrapping but simulation of the ratio? This is only possible if the inverse moments exist - see http://www.stephanehess.me.uk/papers/jo ... n_2012.pdf

It's easy to get the full distribution in Apollo using apollo_unconditionals
Referring to your mentioned paper in my case it should be fine using simulation of the ratio as my cost coefficient is lognormally distributed and the other attributes are normally distributed.
I tried the following code but no results are given in R.
unconditionals <- apollo_unconditionals(model,apollo_probabilities, apollo_inputs)
WTP_A2 = unconditionals[["b_A2"]]/unconditionals[["b_cost"]]
If my cost coefficient is lognormally distributed (the only random coefficient in my model) and the other attributes are dummy coded and therefore fixed coefficients, the WTP can be computed via delta method like b_A2/mu_cost or is there also other approach needed?

No, this is not correct. Mu is the mean of the distribution of the log of the coefficient. You need to divide b_A2 by the full distribution, using simulation. It's easy to get the full distribution in Apollo using apollo_unconditionals
I tried the following code but got an error message:

unconditionals <- apollo_unconditionals(model,apollo_probabilities, apollo_inputs)
WTP_A2_level1 = "b_ A2_level1 "/(unconditionals[["b_Cost"]])
Error: "non-numeric argument to binary operator"
In latent class models the WTP can be calculated via delta method just that it is calculated separately for each class via b_A2_class_a/b_cost_class_a and b_A2_class_b/b_cost_class_b, right?

You don't need the delta method for the calculation of the wtp, only for the standard errors thereof. But your calculation above is correct, but you then still need to take the weighted average across classes.
Can you explain what you mean to take the weighted average across classes when I´ve put my calculation with delta method like this:
deltaMethod_settings=list(expression=c(WTP_A2_a="(b_A2_class_a/b_cost_class_a )", WTP_A2_b="(b_A2_class_b/b_cost_class_b)"))
apollo_deltaMethod(model, deltaMethod_settings)

Thank you very much.

Re: WTP for mixed logit with random parameters

Posted: 24 Apr 2023, 18:29
by stephanehess
Hi

apologies for the slow response, the forum was offline due to a technical issue.

You say
I tried the following code but no results are given in R.
unconditionals <- apollo_unconditionals(model,apollo_probabilities, apollo_inputs)
WTP_A2 = unconditionals[["b_A2"]]/unconditionals[["b_cost"]]
what exactly do you mean that no results are given in R. They should be in WTP_A2

Regarding
Can you explain what you mean to take the weighted average across classes when I´ve put my calculation with delta method like this:
deltaMethod_settings=list(expression=c(WTP_A2_a="(b_A2_class_a/b_cost_class_a )", WTP_A2_b="(b_A2_class_b/b_cost_class_b)"))
this gives you WTP in the two classes. I assumed you wanted the unconditional WTP too?

Re: WTP for mixed logit with random parameters

Posted: 23 May 2023, 19:07
by JuliavB
When I assume the price parameter to be fixed and the other two parameters being random, can the WTP and its confidence intervalls be computed with the following code or am I missing anything: Do I have to account for the sigma in any way or is it considered when using the delta method code already?

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

Re: WTP for mixed logit with random parameters

Posted: 26 May 2023, 16:36
by dpalma
Hi,

The function apollo_deltaMethod will not take into consideration sigma_A2 and sigma_A3 unless you specifically include them in the expression. So when you write:

Code: Select all

deltaMethod_settings=list(expression=c(WTP_A2="(mu_A2/b_price)", WTP_A3="(mu_A3/b_price)"))
apollo_deltaMethod(model, deltaMethod_settings)
The answer is no, your results will ignore the randomness of coefficients b_A2 and b_A3. Where b_A2 and b_A3 are the coefficients with mean mu_A2 and mu_A3, respectively, and standard deviation sigma_A2 and sigma_A3, respectively.

Now, if b_A2 and b_A3 follow a normal distribution, then your code would be calculating the expected value (and its s.e.) of the WTP for A2 and A3. Which is probably what you want.

But in the more general case (e.g. when you are not using normally distributed random coefficients), what I would recommend is simulating the expected value of the WTP. You can do this by getting the unconditional draws of b_A2 and b_A3, divide those draws by b_price, and that would give you the distribution of the WTPs. You can then get the average of that, which will be the expected value of the WTPs. The code below should do that for A2:

Code: Select all

un <- apollo_unconditionals(model, apollo_probabilities, apollo_inputs)
mean(un$beta_A2/model$estimate["b_price"]) # expected value of WTP for A2.
Note that doing sd(un$beta_A2/model$estimate["b_price"]) will not give you the s.e. of the expected value of the WTP, but instead will just give you s.d. of the WTP, which should be very close to sigma_A2/b_price

Hope this helps

Best wishes
David

Re: WTP for mixed logit with random parameters

Posted: 29 May 2023, 15:32
by JuliavB
Hi David,

your response helps a lot, thank you very much.
So just to get you right: With my initial code below I can indeed calculate the expected value of the WTP for A2 and A3 and its s.e. - all under the assumption that A2 and A3 are normally distributed random parameters.

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

Now, why is the more general case for you to have not normally distributed coefficients, from what I have understood from other research, the standard case is to have normally distributed random parameters, isn´t it?

Following your approach I get the results below:

> ### 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

The s.d. looks quite high, whilst the s.e. of the calculation with delta method with my initial code seems to be much lower. Could that be for the accounted randomness in your proposed code? Or what might be the reason?
Expression Value Robust s.e. Rob t-ratio (0)
WTP_Hoehe 0.4026 0.0542 7.43

Now when sd(un$b_HoeheEEE/model$estimate["b_Beitr"]) only gives me the s.d. of the WTP and not of the expected value of the WTP which confidence intervall can be reported then for the expected value of the WTP?

Thank you very much for your support on this.