I am coming over from R and the mlogit package and I have the data formatted in the same way. It seems like xlogit is expecting that when in long format there's the same number of alt rows for each id group. Is this expected behavior for xlogit? Am I attempting to do something that just isn't possible?
model = MultinomialLogit()
model.fit(X=df[vars], y=df['result'], varnames=vars, ids=df['id'], alts=df['alt_id'])
model.summary()
| id |
alt_id |
var1 |
var2 |
var3 |
var4 |
result |
| 1 |
1 |
3 |
4 |
5 |
6 |
0 |
| 1 |
2 |
3 |
4 |
5 |
6 |
0 |
| 1 |
3 |
3 |
4 |
5 |
6 |
1 |
| 1 |
4 |
3 |
4 |
5 |
6 |
0 |
| 2 |
1 |
3 |
4 |
5 |
6 |
0 |
| 2 |
2 |
3 |
4 |
5 |
6 |
1 |
| 2 |
3 |
3 |
4 |
5 |
6 |
0 |
| 3 |
1 |
3 |
4 |
5 |
6 |
0 |
| 3 |
2 |
3 |
4 |
5 |
6 |
0 |
| 3 |
3 |
3 |
4 |
5 |
6 |
0 |
| 3 |
4 |
3 |
4 |
5 |
6 |
0 |
| 3 |
5 |
3 |
4 |
5 |
6 |
1 |
I am coming over from R and the mlogit package and I have the data formatted in the same way. It seems like xlogit is expecting that when in long format there's the same number of alt rows for each id group. Is this expected behavior for xlogit? Am I attempting to do something that just isn't possible?