1
我每次嘗試運行混合logit模型時都會使用此數據上的「mlogit」,但我無法弄清楚我錯過了。這是關於車輛的聯合調查的離散選擇數據。數據使用效果編碼進行編碼。這裏是我正在準備的數據mlogit:在R中使用'mlogit'來估計離散選擇數據的錯誤:無效的'times'參數
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
當我運行此,這裏是我的錯誤:
> 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
不是一個直接的答案,但在biogeme設置混合logit模型是更直接恕我直言:恕我直言:http://biogeme.epfl.ch/ – Chase