Hi Prof. Hess,
I try to implement a mixed logit model considering both observed and unobserved heterogeneity, but have a few confusions on the model specification.
I intend to specify the coefficient for a cost variable to be random but also relate to income (greater income, less sensitive to cost). So for the normal distribution, I have tried the following two specifications (1) and (2), and the model results prefer the first one. I am not sure whether this is dataset specific. Generally I feel the first specification is more intuitive, as it clearly shows that the importance of cost consists of one observed component linked to income and one purely random component.
(1) randcoeff[["rand_cost"]] = b_cost / income + sigma_cost * norm_draws
(2) randcoeff[["rand_cost"]] = (b_cost + sigma_cost * norm_draws)/ income
Similarly, for the lognormal distribution, we also have the following two:
(3) randcoeff[["rand_cost"]] = - exp(b_cost / income + sigma_cost * norm_draws)
(4) randcoeff[["rand_cost"]] = - exp(b_cost + sigma_cost * norm_draws) / income
Lastly, for the triangular distribution,
(5) randcoeff[["rand_cost"]] = a / income + b * (draws_u1 + draws_u2)
(6) randcoeff[["rand_cost"]] = a / income + b / income * (draws_u1 + draws_u2)
(7) randcoeff[["rand_cost"]] = [a + b * (draws_u1 + draws_u2)] / income
Thanks for your time and appreciate if you can help to clarify which one is the appropriate specification.
Best,
Wenjian
Important: Read this before posting to this forum
- 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.
- 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
- Before asking a question on the forum, users are kindly requested to follow these steps:
- Check that the same issue has not already been addressed in the forum - there is a search tool.
- 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
- Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
- Make sure that R is using the latest official release of Apollo.
- Users can check which version they are running by entering packageVersion("apollo").
- Then check what is the latest full release (not development version) at http://www.ApolloChoiceModelling.com/code.html.
- To update to the latest official version, just enter install.packages("apollo"). To update to a development version, download the appropriate binary file from http://www.ApolloChoiceModelling.com/code.html, and install the package from file
- If the above steps do not resolve the issue, then users should follow these steps when posting a question:
- provide full details on the issue, including the entire code and output, including any error messages
- 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.
Observed and unobserved heterogeneity
-
- Site Admin
- Posts: 1040
- Joined: 24 Apr 2020, 16:29
Re: Observed and unobserved heterogeneity
Wenjian
of course, I would strongly recommend against using a Normal distribution for a cost coefficient. That aside, I would also suggest not just dividing by cost as you're making the strong assumption about the income elasticity.
Instead, I would do something like this (with a negative lognormal here)
randcoeff[["rand_cost"]] = - exp(b_cost + sigma_cost * norm_draws) * (income/av_income)^lambda_income
where av_income is for normalisation and lambda_income is an estimated income elasticity.
See example 3 on the website for more details on this in an MNL context
Stephane
of course, I would strongly recommend against using a Normal distribution for a cost coefficient. That aside, I would also suggest not just dividing by cost as you're making the strong assumption about the income elasticity.
Instead, I would do something like this (with a negative lognormal here)
randcoeff[["rand_cost"]] = - exp(b_cost + sigma_cost * norm_draws) * (income/av_income)^lambda_income
where av_income is for normalisation and lambda_income is an estimated income elasticity.
See example 3 on the website for more details on this in an MNL context
Stephane
Re: Observed and unobserved heterogeneity
Hi Prof. Hess,
Thanks for your help! I found the estimated income elasticity to be highly insignificant. So I tried another specification by interacting cost coefficient with a high-income dummy.
randcoeff[["rand_cost"]] = - exp(b_cost + sigma_cost * norm_draws) * (delta * income_high + (1 - income_high)).
I actually have another question about using Johnson Sb distribution. Would you share your experience in setting the start values for a, b, mu, and sigma? I have played with a few start values, but they show very different results, and crazy estimates with NaN standard errors.
randcoeff[["rand_cost"]] = a + b / (1 + exp(-(mu + sigma * norm_draws))).
Best,
Wenjian
Thanks for your help! I found the estimated income elasticity to be highly insignificant. So I tried another specification by interacting cost coefficient with a high-income dummy.
randcoeff[["rand_cost"]] = - exp(b_cost + sigma_cost * norm_draws) * (delta * income_high + (1 - income_high)).
I actually have another question about using Johnson Sb distribution. Would you share your experience in setting the start values for a, b, mu, and sigma? I have played with a few start values, but they show very different results, and crazy estimates with NaN standard errors.
randcoeff[["rand_cost"]] = a + b / (1 + exp(-(mu + sigma * norm_draws))).
Best,
Wenjian
-
- Site Admin
- Posts: 1040
- Joined: 24 Apr 2020, 16:29
Re: Observed and unobserved heterogeneity
Hi Wenjian
yes, that specification is fine, though of course it's very subjective to decide what is high income.
Regarding Johnson SB, my personal experience is that this distribution is indeed quite unstable. The choice of starting parameters is very application specific, but one option could be to estimate a model with a Normal first, and let that help you decide about appropriate values for a and b, as well mu and sigma.
Stephane
yes, that specification is fine, though of course it's very subjective to decide what is high income.
Regarding Johnson SB, my personal experience is that this distribution is indeed quite unstable. The choice of starting parameters is very application specific, but one option could be to estimate a model with a Normal first, and let that help you decide about appropriate values for a and b, as well mu and sigma.
Stephane