我有选择实验,该实验具有1个具有三个级别的属性(REC)和支付此属性的价格。因此,每个id必须考虑8个选择集场景,每个集合具有3个选项(0、1和3)
SELECT
ID,
100.0*(COALESCE(Col1, 0) + COALESCE(Col2, 0) + ... + COALESCE(Col10, 0)) / 10 AS pct
FROM yourTable;
我转换数据:
$ id : num [1:1944] 1 1 1 1 1 1 1 1 1 1 ...
$ set : num [1:1944] 1 1 1 2 2 2 3 3 3 4 ...
$ option: Factor w/ 3 levels "1","2","3": 1 2 3 1 2 3 1 2 3 1 ...
$ choice: chr [1:1944] "FALSE" "TRUE" "FALSE" "FALSE" ...
$ REC : chr [1:1944] "rec1" "rec1" "rec0" "rec2" ...
$ PRICE : num [1:1944] 1000 2500 0 2500 1000 0 1500 2500 0 2500
我做了以下模型:
test.mlogit2<- mlogit.data(Choicedata2, choice = "choice", shape = "long", alt.var = "option", id.var = "id")
我有这个错误:
Clogit2 <- mlogit(choice~REC+PRICE,data=test.mlogit2, reflevel = 3)
summary(Clogit2)
我仅使用REC进行了测试:
Error in solve.default(H, g[!fixed]) :
system is computationally singular: reciprocal condition number = 1.06743e-21
但是我没有结果:p值为1
Clogit2 <- mlogit(choice~REC,data=test.mlogit2, reflevel = 3)
summary(Clogit2)