Search code examples
rinteractionmlogit

Is it possible to introduce an interaction term between an alternative specific and an individual specific variable to a mlogit modell


I'm trying to predict the options of a choice experiment using the r funciton mlogit. I have alternative specific variables and individual specific variables. Now I'd like to introduce an interaction term between one of the alternative specific variables and one of the individual specific variables. Therefore my question: is this possible? And if yes, how does the formula have to be specified? And if no, is there another package that supports this?

In the paper introducing mlogit (http://www2.uaem.mx/r-mirror/web/packages/mlogit/vignettes/mlogit.pdf) the use of alternative and individual specific variables is specified as follows (with x1 being the alternative specific variable and x2 the individual specific):

f1 <- mFormula(y ~ x1 | x2)

So I tried several variations, but none of them yielded the desired results:

f1 <- mFormula(y ~ x1 | x1*x2 | x2)
f1 <- mFormula(y ~ x1*x2 | x2)
f1 <- mFormula(y ~ x1 | x1*x2)

Resp. I always get an error due to singularity (the reciprocal condition number varies, but the error stays the same):

Error in solve.default(H, g[!fixed]) : 
  system is computationally singular: reciprocal condition number = 3.99539e-21

Solution

  • Estimating the system with interaction of alternative and individual interaction variables is mathematically impossible, because the system becomes singular. Intuitively, by introducing such interaction you want to say that some individuals are more likely to purchase certain alternative - but this case is already "covered" by individual-specific variables.

    See page 7 of the paper:

    One has to consider three kinds of variables:

    • alternative specific variables x_ij with a generic coefficient beta,
    • individual specific variables z_i with an alternative specific coefficients gamma_j,
    • alternative specific variables w_ij with an alternative specific coefficient delta_j

    I guess the case 2 is what you want.