[R] mlogit: nested model with constant option in degenerate partition

Felix Eggers - Uni Hamburg eggers at econ.uni-hamburg.de
Wed Jul 6 16:31:29 CEST 2011


Dear R users,

I am trying to estimate a nested logit model that has a constant option in
a degenerate partition. The data set is a conjoint survey where
respondents were asked to answer multiple choice sets. The choice sets
consist of three alternatives (described by four varying attributes) and a
no-choice option, i.e., none of the three alternatives. In the nested
model one branch should represent the three varying choice options and the
other branch the no-choice option. However, the R code I am using results
in an error message because the no-choice option is not varying in the
four attributes that I included in the mlogit formula. Is there another
way of coding the no-choice option in this way?

This is the R code I am using:

> library(mlogit)
> IA<-read.csv2("test.csv")
# attributes are R, H, J, V, each having three levels.
# r1, r2, h1, h2, etc are effect codes of these attribute levels.
> head(IA, 20)

   Resp_id Resp_count chid Alternative_id Alt_text r1 r2 h1 h2 j1 j2 v1 v2
none_dummy selection_dummy
1   100007          1    1              1     Alt1  0  1  0  1 -1 -1  0  1
         0               0
2   100007          1    1              2     Alt2  1  0  1  0  0  1  1  0
         0               0
3   100007          1    1              3     Alt3 -1 -1 -1 -1  1  0 -1 -1
         0               1
4   100007          1    1              4 NoChoice  0  0  0  0  0  0  0  0
         1               0
5   100007          1    2              1     Alt1  0  1 -1 -1  0  1 -1 -1
         0               0
6   100007          1    2              2     Alt2 -1 -1  1  0 -1 -1  1  0
         0               1
7   100007          1    2              3     Alt3  1  0  0  1  1  0  0  1
         0               0
8   100007          1    2              4 NoChoice  0  0  0  0  0  0  0  0
         1               0
9   100007          1    3              1     Alt1  0  1  1  0  1  0  1  0
         0               0
10  100007          1    3              2     Alt2 -1 -1  0  1  0  1  0  1
         0               0
11  100007          1    3              3     Alt3  1  0 -1 -1 -1 -1 -1 -1
         0               0
12  100007          1    3              4 NoChoice  0  0  0  0  0  0  0  0
         1               1
13  100007          1    4              1     Alt1  0  1  1  0  1  0 -1 -1
         0               0
14  100007          1    4              2     Alt2 -1 -1  0  1  0  1  1  0
         0               1
15  100007          1    4              3     Alt3  1  0 -1 -1 -1 -1  0  1
         0               0
16  100007          1    4              4 NoChoice  0  0  0  0  0  0  0  0
         1               0
17  100007          1    5              1     Alt1 -1 -1 -1 -1  1  0  0  1
         0               0
18  100007          1    5              2     Alt2  0  1  0  1 -1 -1  1  0
         0               0
19  100007          1    5              3     Alt3  1  0  1  0  0  1 -1 -1
         0               0
20  100007          1    5              4 NoChoice  0  0  0  0  0  0  0  0
         1               1

> IADATA<-mlogit.data(IA, choice="selection_dummy", shape="long",
alt.var="Alt_text", id.var="Resp_count", chid="chid")
> nl<-mlogit(selection_dummy~r1+r2+h1+h2+j1+j2+v1+v2 | 0, data=IADATA,
nests = list(opt1 = c("Alt1", "Alt2", "Alt3"), opt2 = "NoChoice"),
unscaled=TRUE )

 Error in solve.default(crossprod(attr(x, "gradi")[, !fixed])) :
  Lapack routine dgesv: system is exactly singular

Thank you for your help!

Best,
Felix

---
Felix Eggers



More information about the R-help mailing list