error using 'mlogit' in R to estimate discrete choice data: invalid 'times' argument

I am getting this error every time I try and run a mixed logit model using "mlogit" on this data, and I cannot figure out what I am missing. This is discrete choice data from a conjoint survey about vehicles. The data is coded using effects coding. Here is how I am preparing the data for mlogit:

DATA <- mlogit.data(data, id.var="id", shape="long", choice="choice", alt.var="alt")

> head(DATA)
    id Task alt Answer choice Price2 Price3 Price4 Price5 American Japanese
1.1  1    1   1      3  FALSE      0      0      1      0        0        0
1.2  1    1   2      3  FALSE      0      0      0      1        0        0
1.3  1    1   3      3   TRUE     -1     -1     -1     -1       -1       -1
2.1  1    2   1      1   TRUE     -1     -1     -1     -1        0        0
2.2  1    2   2      1  FALSE      0      1      0      0        1        0
2.3  1    2   3      1  FALSE      0      0      1      0        0        1
    Chinese SKorean HEV PHEV10 PHEV20 PHEV40 EV75 EV100 EV150 F20 F30 FNA s6
1.1       0       1   0      1      0      0    0     0     0   1   0   0  1
1.2       1       0   0      0      0      1    0     0     0   0   1   0 -1
1.3      -1      -1   0      0      0      0    1     0     0   0   0   1  1
2.1       1       0   0      1      0      0    0     0     0   0   1   0 -1
2.2       0       0   0      0      0      0    0     1     0   1   0   0  1
2.3       0       0   0      0      1      0    0     0     0  -1  -1  -1  0
    s10 eff2 eff3 eff4 accel2 accel3 accel4
1.1   0    0    0    1      1      0      0
1.2  -1   -1   -1   -1      0      0      1
1.3   0    1    0    0     -1     -1     -1
2.1  -1    0    1    0      1      0      0
2.2   0    0    1    0     -1     -1     -1
2.3   1   -1   -1   -1      0      1      0

When I run this, here is the error I get:

> mixed.est <- mlogit(choice ~ Price2 + Price3 + Price4 + Price5 + American + Japanese + 
Chinese + SKorean + HEV + PHEV10 + PHEV20 + PHEV40 + EV75 + EV100 + EV150 + F20 + F30 +  
FNA + s6 + s10 + eff2 + eff3 + eff4 + accel2 + accel3 + accel4|0, DATA, 
rpar=c(Price2='n', Price3='n', Price4='n', Price5='n', American='n', Japanese='n', 
Chinese='n', SKorean='n', HEV='n', PHEV10='n', PHEV20='n', PHEV40='n', EV75='n', 
EV100='n', EV150='n', F20='n', F30='n', FNA='n', S6='n', S10='n', eff2='n', eff3='n', 
eff4='n', accel2='n', accel3='n', accel4='n'), R=100, halton=NA, print.level=0, panel=F)

Error in rep(halt, prime - 1) : invalid 'times' argument

Answers


I think you use too many random parameters (25). I had the same problem using more than 9. Nevertheless, older versions of mlogit could estimate models with large parameter dimensions, but many parameters = highly correlated halton draws (over dimensions), so "standard halton draws" may be a bad idea for your purpose. (see Train 2009, pp. 231-235) Best dg


Need Your Help

Why in node.js do you have a number of workers equal to cpu cores when there's a master worker too?

node.js multithreading server

Sorry I don't think the title to the question is particularly great, I struggled to create a suitable one for the multiple questions I have.