mixed models - R mlogit-Error system is computationally singular: reciprocal condition number -
i using library(mlogit) in r , stuck @ particular data set looks this
customerid item price calories choice 1 200 1.99 490 no 1 312 4.99 887 no 1 560 5.19 910 no 1 700 4.79 690 no 1 909 4.89 660 no 1 1705 4.00 840 no
there 187 items in total , 4 customerid(1,2,3 , 4). each customer presented choice set of 187 items selects 1 based on price , calories. price , calories remain same 4 customers.
> str(data) 'data.frame': 748 obs. of 5 variables: $ customerid: int 1 1 1 1 1 1 1 1 1 1 ... $ item : factor w/ 187 levels "200","231","232",..: 1 11 14 15 18 25 33 34 36 39 ... $ price : num 1.99 4.99 5.19 4.79 4.89 4 4 4 4 6.21 ... $ calories : int 490 887 910 690 660 840 1638 1559 1530 1559 ... $ choice : factor w/ 2 levels "no ","yes": 1 1 1 1 1 1 1 1 1 1 ...
i format data according mlogit command in manner below:-
m<- mlogit.data(data, choice="choice", shape="long", alt.levels=c("200", "231", "232", "240",.....(*all 187 'item' here)*))
which gives me this:-
head(m) customerid item price calories choice 1.200 1 200 1.99 490 no 1.231 1 231 1.19 320 yes 1.232 1 232 1.49 320 no 1.240 1 240 4.79 590 no 1.250 1 250 2.39 490 no 1.253 1 253 4.49 691 no
my dataset ordered cutomerid , item had read in previous question might cause issue.
i try several formulas none of them runs
tr.ml <- mlogit(choice ~0|price+calories|0,m) error in solve.default(h, g[!fixed]) : lapack routine dgesv: system singular: u[548,548] = 0 in addition: there 50 or more warnings (use warnings() see first 50)
the correlation between price , calories 43%
cor(m$price,m$calories) [1] 0.429796
i tried this:-
tr.ml <- mlogit(choice ~price+calories,m) error in solve.default(h, g[!fixed]) : system computationally singular: reciprocal condition number = 1.06243e-23 in addition: there 50 or more warnings (use warnings() see first 50)
can provide thoughts on resolving error? have been @ 2 weeks now.
Comments
Post a Comment