Skip to content

inconsistent alts values in long format #21

@novak

Description

@novak

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions