0

I'm using below r command on my choice model data which is perfectly working:

  • mlmodel_BL <- mlogit(choice ~ Price + Feature + Brloy , data = mldata_BL, reflevel = "Brand4")

but when I want to add interaction there, I face singularity error.

  • mlmodel_BL2 <- mlogit(choice ~ Price + Feature + Brloy + Income*Price , data = mldata_BL, reflevel = "Brand4")

error:

  • Error in solve.default(H, g[!fixed]) :
  • Lapack routine dgesv: system is exactly singular: U[7,7] = 0

I tried below command and it worked, however, I prefer to include interaction form in my model instead of changing my data:

  • mldata_BL$Price_Income <- mldata_BL$Price * mldata_BL$Income

  • mlmodel_BL2 <- mlogit(choice ~ Price + Feature + Brloy + Price_Income , data = mldata_BL, reflevel = "Brand4")

would you please guide me on what might cause this issue in my code? thanks

Lili.Y
  • 13
  • 3
  • the first interaction and the second interaction define two different models. the second one takes as regressor the product of price and income, but the main effects are missing. the first model has 6 regressors (Price,Feature,Brloy,Income,Price,Income*Price). with the intercept, these are 7 regressors. But the system of 7 regressors is singular, hence the error message: Lapack routine dgesv: system is exactly singular: U[7,7] = 0. – papgeo Dec 05 '19 at 07:28
  • @papgeo thanks a lot for your help. would you please help me then which of the below codes are correct: 1) mlmodel_BL2 =mlogit(choice ~ Price + Feature + Brloy | Price * Income , data = mldata_BL, reflevel = "Brand4") 2) mlmodel_BL2 = mlogit(choice ~ Price + Feature + Brloy | Price * Income + Income , data = mldata_BL, reflevel = "Brand4") 3) mlmodel_BL2 =mlogit(choice ~ Price + Feature + Brloy | Price * Income | Income , data = mldata_BL, reflevel = "Brand4") – Lili.Y Dec 05 '19 at 22:55
  • I don't see anything wrong with any of the model specifications. – papgeo Dec 06 '19 at 01:35

0 Answers0