Dear Stata List,
I used to perform choice models using -mlogit-, -clogit-, -mixlogit-, or -lclogit2- commands. I am now interested in the cm features provided by Stata.
My issue is as follows.
I want to declare my data base as being a choice model setting dataset but my data base is quite different from what I red in the Stata Choice Models Reference Manuals and I did not find a solution to my problem.
I have 3 alternatives (1, 2, and 3) and 12 choice tasks by ID. Thus, a total of 36 rows by ID. The third alternative corresponds to an opt-out option (a treatment refusal). Each choice task corresponds to a triade of alternatives and the alternatives chosen takes the value 1 (0 otherwise). The alternative specific constant (the opt-out option) is coded (1,1,0) if the respondent chose the alternative one or two and (0,0,1) if he chose the alternative 3 (the opt-out).
Moreover, each attributes' levels are dummy coded.
My question is: How can I declare my database using the -cmset- command ?
Thanks all !
Gabin.
Here is an illustration of my data base setting with the ID, the # of the choice task, the alternatives, the choice made by respondent, the ASC/opt-out, invariant variables (here gender and age), and the first attribute described by six levels.
I used to perform choice models using -mlogit-, -clogit-, -mixlogit-, or -lclogit2- commands. I am now interested in the cm features provided by Stata.
My issue is as follows.
I want to declare my data base as being a choice model setting dataset but my data base is quite different from what I red in the Stata Choice Models Reference Manuals and I did not find a solution to my problem.
I have 3 alternatives (1, 2, and 3) and 12 choice tasks by ID. Thus, a total of 36 rows by ID. The third alternative corresponds to an opt-out option (a treatment refusal). Each choice task corresponds to a triade of alternatives and the alternatives chosen takes the value 1 (0 otherwise). The alternative specific constant (the opt-out option) is coded (1,1,0) if the respondent chose the alternative one or two and (0,0,1) if he chose the alternative 3 (the opt-out).
Moreover, each attributes' levels are dummy coded.
My question is: How can I declare my database using the -cmset- command ?
Thanks all !
Gabin.
Here is an illustration of my data base setting with the ID, the # of the choice task, the alternatives, the choice made by respondent, the ASC/opt-out, invariant variables (here gender and age), and the first attribute described by six levels.
Code:
. list ID Choice_Task Alternative Choice ASC Female Age A1L1 A1L2 A1L3 A1L4 A1L5 A1L6 in 1/144, sepby(ID)
+--------------------------------------------------------------------------------------------------+
| ID Choice~k Altern~e Choice ASC Female Age A1L1 A1L2 A1L3 A1L4 A1L5 A1L6 |
|--------------------------------------------------------------------------------------------------|
1. | 3 1 1 1 1 0 40 1 0 0 0 0 0 |
2. | 3 1 2 0 1 0 40 0 1 0 0 0 0 |
3. | 3 1 3 0 0 0 40 0 0 0 0 0 0 |
4. | 3 2 1 1 1 0 40 0 0 0 0 1 0 |
5. | 3 2 2 0 1 0 40 0 0 1 0 0 0 |
6. | 3 2 3 0 0 0 40 0 0 0 0 0 0 |
7. | 3 3 1 0 1 0 40 0 0 0 1 0 0 |
8. | 3 3 2 1 1 0 40 0 1 0 0 0 0 |
9. | 3 3 3 0 0 0 40 0 0 0 0 0 0 |
10. | 3 4 1 1 1 0 40 0 0 0 1 0 0 |
11. | 3 4 2 0 1 0 40 0 0 0 0 1 0 |
12. | 3 4 3 0 0 0 40 0 0 0 0 0 0 |
13. | 3 5 1 1 1 0 40 0 0 0 0 1 0 |
14. | 3 5 2 0 1 0 40 1 0 0 0 0 0 |
15. | 3 5 3 0 0 0 40 0 0 0 0 0 0 |
16. | 3 6 1 1 1 0 40 0 0 0 0 0 1 |
17. | 3 6 2 0 1 0 40 1 0 0 0 0 0 |
18. | 3 6 3 0 0 0 40 0 0 0 0 0 0 |
19. | 3 7 1 1 1 0 40 0 0 0 0 0 1 |
20. | 3 7 2 0 1 0 40 0 1 0 0 0 0 |
21. | 3 7 3 0 0 0 40 0 0 0 0 0 0 |
22. | 3 8 1 1 1 0 40 0 0 0 1 0 0 |
23. | 3 8 2 0 1 0 40 0 0 1 0 0 0 |
24. | 3 8 3 0 0 0 40 0 0 0 0 0 0 |
25. | 3 9 1 0 1 0 40 1 0 0 0 0 0 |
26. | 3 9 2 1 1 0 40 0 0 0 0 1 0 |
27. | 3 9 3 0 0 0 40 0 0 0 0 0 0 |
28. | 3 10 1 0 1 0 40 0 1 0 0 0 0 |
29. | 3 10 2 1 1 0 40 0 0 0 0 0 1 |
30. | 3 10 3 0 0 0 40 0 0 0 0 0 0 |
31. | 3 11 1 1 1 0 40 0 0 0 1 0 0 |
32. | 3 11 2 0 1 0 40 0 0 1 0 0 0 |
33. | 3 11 3 0 0 0 40 0 0 0 0 0 0 |
34. | 3 12 1 1 1 0 40 0 0 0 0 1 0 |
35. | 3 12 2 0 1 0 40 0 0 1 0 0 0 |
36. | 3 12 3 0 0 0 40 0 0 0 0 0 0 |
|--------------------------------------------------------------------------------------------------|
37. | 4 1 1 1 1 0 59 1 0 0 0 0 0 |
38. | 4 1 2 0 1 0 59 0 1 0 0 0 0 |
39. | 4 1 3 0 0 0 59 0 0 0 0 0 0 |
40. | 4 2 1 0 1 0 59 0 0 0 0 0 1 |
41. | 4 2 2 1 1 0 59 0 1 0 0 0 0 |
42. | 4 2 3 0 0 0 59 0 0 0 0 0 0 |
43. | 4 3 1 0 1 0 59 0 0 0 1 0 0 |
44. | 4 3 2 1 1 0 59 0 0 1 0 0 0 |
45. | 4 3 3 0 0 0 59 0 0 0 0 0 0 |
46. | 4 4 1 0 1 0 59 0 1 0 0 0 0 |
47. | 4 4 2 1 1 0 59 0 0 0 1 0 0 |
48. | 4 4 3 0 0 0 59 0 0 0 0 0 0 |
49. | 4 5 1 0 1 0 59 0 0 0 0 0 1 |
50. | 4 5 2 1 1 0 59 1 0 0 0 0 0 |
51. | 4 5 3 0 0 0 59 0 0 0 0 0 0 |
52. | 4 6 1 0 1 0 59 0 0 1 0 0 0 |
53. | 4 6 2 1 1 0 59 0 0 0 1 0 0 |
54. | 4 6 3 0 0 0 59 0 0 0 0 0 0 |
55. | 4 7 1 1 1 0 59 0 0 0 0 0 1 |
56. | 4 7 2 0 1 0 59 0 0 0 0 1 0 |
57. | 4 7 3 0 0 0 59 0 0 0 0 0 0 |
58. | 4 8 1 1 1 0 59 1 0 0 0 0 0 |
59. | 4 8 2 0 1 0 59 0 0 0 0 0 1 |
60. | 4 8 3 0 0 0 59 0 0 0 0 0 0 |
61. | 4 9 1 1 1 0 59 0 1 0 0 0 0 |
62. | 4 9 2 0 1 0 59 0 0 1 0 0 0 |
63. | 4 9 3 0 0 0 59 0 0 0 0 0 0 |
64. | 4 10 1 0 1 0 59 0 0 0 0 1 0 |
65. | 4 10 2 1 1 0 59 0 0 0 1 0 0 |
66. | 4 10 3 0 0 0 59 0 0 0 0 0 0 |
67. | 4 11 1 0 0 0 59 0 0 0 0 0 1 |
68. | 4 11 2 0 0 0 59 0 1 0 0 0 0 |
69. | 4 11 3 1 1 0 59 0 0 0 0 0 0 |
70. | 4 12 1 1 1 0 59 0 0 0 0 0 1 |
71. | 4 12 2 0 1 0 59 0 1 0 0 0 0 |
72. | 4 12 3 0 0 0 59 0 0 0 0 0 0 |
|--------------------------------------------------------------------------------------------------|
73. | 5 1 1 1 1 0 31 1 0 0 0 0 0 |
74. | 5 1 2 0 1 0 31 0 1 0 0 0 0 |
75. | 5 1 3 0 0 0 31 0 0 0 0 0 0 |
76. | 5 2 1 1 1 0 31 0 0 1 0 0 0 |
77. | 5 2 2 0 1 0 31 0 0 0 1 0 0 |
78. | 5 2 3 0 0 0 31 0 0 0 0 0 0 |
79. | 5 3 1 1 1 0 31 1 0 0 0 0 0 |
80. | 5 3 2 0 1 0 31 0 0 0 0 0 1 |
81. | 5 3 3 0 0 0 31 0 0 0 0 0 0 |
82. | 5 4 1 0 1 0 31 0 0 0 0 1 0 |
83. | 5 4 2 1 1 0 31 0 0 0 0 0 1 |
84. | 5 4 3 0 0 0 31 0 0 0 0 0 0 |
85. | 5 5 1 0 0 0 31 0 1 0 0 0 0 |
86. | 5 5 2 0 0 0 31 0 0 1 0 0 0 |
87. | 5 5 3 1 1 0 31 0 0 0 0 0 0 |
88. | 5 6 1 1 1 0 31 1 0 0 0 0 0 |
89. | 5 6 2 0 1 0 31 0 1 0 0 0 0 |
90. | 5 6 3 0 0 0 31 0 0 0 0 0 0 |
91. | 5 7 1 0 1 0 31 0 0 0 1 0 0 |
92. | 5 7 2 1 1 0 31 0 0 0 0 1 0 |
93. | 5 7 3 0 0 0 31 0 0 0 0 0 0 |
94. | 5 8 1 0 0 0 31 0 0 0 0 0 1 |
95. | 5 8 2 0 0 0 31 0 0 1 0 0 0 |
96. | 5 8 3 1 1 0 31 0 0 0 0 0 0 |
97. | 5 9 1 1 1 0 31 1 0 0 0 0 0 |
98. | 5 9 2 0 1 0 31 0 0 0 1 0 0 |
99. | 5 9 3 0 0 0 31 0 0 0 0 0 0 |
100. | 5 10 1 1 1 0 31 1 0 0 0 0 0 |
101. | 5 10 2 0 1 0 31 0 1 0 0 0 0 |
102. | 5 10 3 0 0 0 31 0 0 0 0 0 0 |
103. | 5 11 1 1 1 0 31 0 0 1 0 0 0 |
104. | 5 11 2 0 1 0 31 0 0 0 0 1 0 |
105. | 5 11 3 0 0 0 31 0 0 0 0 0 0 |
106. | 5 12 1 1 1 0 31 0 0 1 0 0 0 |
107. | 5 12 2 0 1 0 31 0 0 0 1 0 0 |
108. | 5 12 3 0 0 0 31 0 0 0 0 0 0 |
|--------------------------------------------------------------------------------------------------|
109. | 6 1 1 1 1 1 62 1 0 0 0 0 0 |
110. | 6 1 2 0 1 1 62 0 1 0 0 0 0 |
111. | 6 1 3 0 0 1 62 0 0 0 0 0 0 |
112. | 6 2 1 1 1 1 62 0 0 0 0 1 0 |
113. | 6 2 2 0 1 1 62 0 0 1 0 0 0 |
114. | 6 2 3 0 0 1 62 0 0 0 0 0 0 |
115. | 6 3 1 0 1 1 62 0 0 0 1 0 0 |
116. | 6 3 2 1 1 1 62 0 1 0 0 0 0 |
117. | 6 3 3 0 0 1 62 0 0 0 0 0 0 |
118. | 6 4 1 0 0 1 62 0 0 0 1 0 0 |
119. | 6 4 2 0 0 1 62 0 0 0 0 1 0 |
120. | 6 4 3 1 1 1 62 0 0 0 0 0 0 |
121. | 6 5 1 1 1 1 62 0 0 0 0 1 0 |
122. | 6 5 2 0 1 1 62 1 0 0 0 0 0 |
123. | 6 5 3 0 0 1 62 0 0 0 0 0 0 |
124. | 6 6 1 1 1 1 62 0 0 0 0 0 1 |
125. | 6 6 2 0 1 1 62 1 0 0 0 0 0 |
126. | 6 6 3 0 0 1 62 0 0 0 0 0 0 |
127. | 6 7 1 1 1 1 62 0 0 0 0 0 1 |
128. | 6 7 2 0 1 1 62 0 1 0 0 0 0 |
129. | 6 7 3 0 0 1 62 0 0 0 0 0 0 |
130. | 6 8 1 1 1 1 62 0 0 0 1 0 0 |
131. | 6 8 2 0 1 1 62 0 0 1 0 0 0 |
132. | 6 8 3 0 0 1 62 0 0 0 0 0 0 |
133. | 6 9 1 1 1 1 62 1 0 0 0 0 0 |
134. | 6 9 2 0 1 1 62 0 0 0 0 1 0 |
135. | 6 9 3 0 0 1 62 0 0 0 0 0 0 |
136. | 6 10 1 0 1 1 62 0 1 0 0 0 0 |
137. | 6 10 2 1 1 1 62 0 0 0 0 0 1 |
138. | 6 10 3 0 0 1 62 0 0 0 0 0 0 |
139. | 6 11 1 0 0 1 62 0 0 0 1 0 0 |
140. | 6 11 2 0 0 1 62 0 0 1 0 0 0 |
141. | 6 11 3 1 1 1 62 0 0 0 0 0 0 |
142. | 6 12 1 1 1 1 62 0 0 0 0 1 0 |
143. | 6 12 2 0 1 1 62 0 0 1 0 0 0 |
144. | 6 12 3 0 0 1 62 0 0 0 0 0 0 |
+--------------------------------------------------------------------------------------------------+


Comment