I am having trouble estimating a mixed logit model with the command -mixlogit- in Stata 14.
I have some individual specific variables of which I know for a fact that they influence the choice that is being made.
The data is as follows:
Each respondent of a survey had to make a choice between three alternatives. They have to do this 8 times in total.
I have some individual specific explanatory variables. For example variable a20 is a dummy variable that is equal to 1 if the age of the respondent is below 20 and 0 otherwise.
I want to estimate the mixed logit model with the following command:
I get the error r(459): "Variable a20 has no within-group variance"
The data for the first respondent can be found below:
I have some individual specific variables of which I know for a fact that they influence the choice that is being made.
The data is as follows:
Each respondent of a survey had to make a choice between three alternatives. They have to do this 8 times in total.
I have some individual specific explanatory variables. For example variable a20 is a dummy variable that is equal to 1 if the age of the respondent is below 20 and 0 otherwise.
I want to estimate the mixed logit model with the following command:
Code:
mixlogit choice td a20, rand(at fee) group(group) id(id)
The data for the first respondent can be found below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(id group) str3 alternative byte(choice at td) double fee byte a20 1 1 "FSP" 1 10 10 0 0 1 1 "PSP" 0 10 10 .6 0 1 1 "PUP" 0 5 10 .8 0 1 2 "FSP" 1 10 15 0 0 1 2 "PSP" 0 10 15 .6 0 1 2 "PUP" 0 5 10 .8 0 1 3 "FSP" 1 15 15 0 0 1 3 "PSP" 0 10 10 .8 0 1 3 "PUP" 0 5 10 .8 0 1 4 "FSP" 1 15 10 0 0 1 4 "PSP" 0 10 15 .8 0 1 4 "PUP" 0 5 10 .8 0 1 5 "FSP" 1 15 15 0 0 1 5 "PSP" 0 10 10 .6 0 1 5 "PUP" 0 5 10 1.5 0 1 6 "FSP" 1 15 10 0 0 1 6 "PSP" 0 10 15 .6 0 1 6 "PUP" 0 5 10 1.5 0 1 7 "FSP" 1 10 10 0 0 1 7 "PSP" 0 10 10 .8 0 1 7 "PUP" 0 5 10 1.5 0 1 8 "FSP" 1 10 15 0 0 1 8 "PSP" 0 10 15 .8 0 1 8 "PUP" 0 5 10 1.5 0 end
Comment