I attached a picture of how my data for conjoint analysis looks. I have a choice variable that people chose among choice card A, B or an opt-out option based on three attributes (Local sourcing, driving distance, bill for two). Each individual answered 9 choice questions. For example, if individual 1 chose A for choice question 1, I coded his/her choice as 1 0 0 and stack them at the end. Therefore, the only variables that changes are my choice variable and attributes variables. Demographic variables stay the same for each person while their choices change for each choice question. The code I ran in Stata is mixlogit ChoiceVariable LocalSourcing DrivingDistance BillForTwo, group( csid ) rand (Gender ) id(id)

but I keep receiving the error Variable Gender has no within-group variance r(459);

I guess it should have something to do with the group variable I defined. I attached a snapshot of the data, I limited independent variables to Age, Gender and Education for convenience.

Thank you so much everyone for your help!

Similar questions and discussions