1. Intercepts and interactions
I want to talk a little bit more about some modeling details that are important and often overlooked.
2. Why no intercepts?
First, let's talk about intercepts. You might be wondering why we don't have a traditional intercept in the formula for the vs. It turns out that if we did this, we would get exactly the same probabilities for p1, p2, and p3 with and without the intercept. If you're good at algebra, you can see that if we added the same constant to v1, v2, and v3, exp(constant) is going to factor out and cancel in the probability formulae.
3. Example with an intercept
Let me show you with a simple example. Here I set the intercept to 5 and compute the probabilities. Now, suppose I change the intercept to zero.
4. Example with an intercept
We get exactly the same probabilities. In statistical terms, we say the intercept is not identified. We fix it to zero by including 0 + in our model formula. If we don't do this, then mlogit() will estimate different intercepts for each alternatives (except one). This is identified, but it doesn't make a lot of sense for this type of survey data. I nearly always leave out the intercept.
5. Interactions
Another thing you should think about when fitting a choice models is whether there are interactions between the attributes. An interaction term is a new model variable created by multiplying together two of the original variables. For example, in this code, I've added an interaction between seat and price.
6. Putting interactions into formulas
While we could create this new interaction variable manually in the data frame, you can also include it in the model formula and mlogit() will do the multiplication for you. For example here is code for estimating a model with an interaction between price and trans.
If you want to save some typing, you can also type trans-star-price, which means I want trans, price and the trans-price interaction in my model.
7. Interpreting interactions
If we look at the model output, we can see the interaction term at the bottom of the coefficients table. It is labeled transmanual:convertyes and is -0-point-14. This means you get a little extra negative value when a sports car has both a manual transmission and a convertible top.
By the way, we haven't talked about the other columns in the coefficients table. Just as in linear regression, the standard error tells us how precisely we can estimate the coefficient with this data. Smaller standard errors are better. The z-value and the p-value tell us whether there is sufficient data to declare the coefficient different than zero. Our new interaction is not significantly different than zero.
8. User variables
Now, you may remember that we had a segment variable in the sportcar data with levels basic, fun and racer. You might be wondering how we could bring the segment variable into the model.
We can't just put it into the utility function because it would be the same for all three alternatives and would cancel out like the intercept did. You'll get an error if you try that.
But we can interact it with one of the attributes. For example, let's include an interaction between price and segment.
When we look at the model coefficients, we can see that the basic segment has a price coefficient of -0-point-22, versus -0-point-13 for the fun and racer segments. This means that the basic segment is much more price sensitive than the other segments. We should keep this interaction in the model. It tells us something important about our customers and will affect our share predictions.
9. Let's try some interactions in the chocolate data.
Whenever you are building a model, you should consider interactions. Let's try it with the chocolate data.