Error in mlogit: error in solve.default (H, g [! Fixed]) file: the system is computationally singular: the number of inverse conditions = 3.4767e-18

I have long-format poll data. The first few lines are as follows:

ID alt choice size tar length brand flavor gender age yr_smoke num_smoke job 1 1 1 no 1 1 1 1 1 2 35 10 20 1 2 1 2 no 1 1 1 1 1 2 35 10 20 1 3 1 3 no 1 1 1 1 1 2 35 10 20 1 4 1 4 no 1 1 1 1 1 2 35 10 20 1 5 1 5 no 1 1 1 1 1 2 35 10 20 1 6 1 6 no 1 1 1 1 1 2 35 10 20 1 

I used mlogit.data as:

 data_mlogit_ct1_test2 <- mlogit.data(data_mlogit_ct1_test1,choice="choice", shape="long",alt.var="alt") 

The first few lines of the converted data are as follows:

  ID alt choice size tar length brand flavor gender age yr_smoke num_smoke job 1.1 1 1 FALSE 1 1 1 1 1 2 35 10 20 1 1.2 1 2 FALSE 1 1 1 1 1 2 35 10 20 1 1.3 1 3 FALSE 1 1 1 1 1 2 35 10 20 1 1.4 1 4 FALSE 1 1 1 1 1 2 35 10 20 1 1.5 1 5 FALSE 1 1 1 1 1 2 35 10 20 1 1.6 1 6 FALSE 1 1 1 1 1 2 35 10 20 1 

Now I am trying to install mlogit as:

  fit_mlogit_ct11 <- mlogit(choice~size+tar+length+brand+flavor, data_mlogit_ct1_test1,shape="long",chid.var="ID", alt.var="alt",method="bfgs",heterosc=TRUE,tol=10) 

I got this error:

Error in resol.default file (crossprod (attr (x, "gradi") [,! Fixed])): Local procedure dgesv: the system is exactly singular

Then I did:

  fit_mlogit_ct11 <- mlogit(choice~size+tar+length+brand+flavor, data_mlogit_ct1_test2) 

Now I got:

Error in solve.default (H, g [! Fixed]) file: the system is computationally singular: the number of inverse conditions = 3.4767e-18

Can someone please help me?

+6
source share
1 answer

I think the problem is that you did not define the correct individual variables. According to the packaging guide, when you create your models using the mlogit function, you can use: | to separate alternatives specific to individual specific variables. For instance:

 fit_mlogit_ct11 <- mlogit(choice~1|size+tar+length+brand+flavor, data_mlogit_ct1_test1,shape="long",chid.var="ID", alt.var="alt",method="bfgs",heterosc=TRUE,tol=10) 

It just says that all of your variables are individual, and you only take an interception for an alternate concrete one. But, as mentioned above, your data looks strange, because it looks the same, since you only have individual specific variables. This ultimately leads to a singularity (your variables are related to each other with 1).

+7
source

All Articles