Predicting shares with hierarchical models
1. Predicting shares with hierarchical models
The last thing to cover is how to predict shares with a hierarchical model. It is very similar to predicting shares with a non-hierarchical model, but requires one additional step.2. Hierarchical model with correlations
We'll start by fitting one last model to the sportscar data. For this model, we're including the extra input correlation = TRUE, which indicates that we want to find a model where decision makers' parameters are potentially correlated. Our previous hierarchical models assumed preferences for different features are independent, which may not be true. Once we have this model, we can look at the estimated correlations between parameters using the command cor-dot-mlogit(m10). This prints out the matrix of correlations which tell us how preferences for the various features are related across decision makers. For example, the largest correlation is the one between transmanual and convertyes, which is -0-point-72. This tells us that people who prefer manual transmissions tend to dislike convertibles. This can be a useful insight when you are designing a set of sports cars to offer to the market. You probably shouldn't make a sports car with a convertible top and a manual. And this will be accounted for when we look at share predictions with model m10.3. Products we want to predict shares for
So, how do we predict shares using m10? Let's predict share for the same pair of products we used in the previous chapter. Both are 2-seaters without convertible tops. One has a manual transmission at $35K and the other has an automatic at $30K. Since we've switched to effects coding, we've effects-coded those products and saved them in prod-dot-coded.4. Share prediction for hierarchical model
Now that we've got a model and a set of products, we're ready to predict shares. Let's walk through the code for doing that. First, we extract the mean and covariance of the individual parameters from the model object and store them as mean and Sigma. These are the parameters of m10. Then we follow the model structure we talked about before. The code loops over 1000 hypothetical decision makers. For each decision maker, we first draw their personal coefficients from a multivariate normal distribution with a mean of mean and a variance of Sigma. Then, once we have the individual's coefficients, we compute the utility for the two products by multiplying the coded product matrix by the individual coefficient vector coef. Then we compute the share for that person following the logit formula that we've seen a few times before. If you aren't familiar with matrix and vector operations in R, you may need to run the different pieces of this code and inspect the results to figure out exactly how it works. Finally, if we average the shares for each person across all 1,000 people using colMeans(), we get our share prediction. You can see that the share for the first car is about 13%, which is very close to the 13-point-3% we got from the non-hierarchical model. Because this is a simulation, the number will move around a little each time you run it. In general, when we account for differences in preferences across consumers, niche products like this manual transmission sports car tend to pick up share and mainstream products tend to lose a little. In this particular data the two predictions land in almost the same place.5. Let's practice!
Now it's your turn to predict shares for the chocolate data. And this will be your last exercise for this course!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.