Help using Base SAS procedures

Replicating Train's "Choice of energy supplier" example using MDC (mixed logit)

Reply
N/A
Posts: 1

Replicating Train's "Choice of energy supplier" example using MDC (mixed logit)

Hi all,

I am trying to replicate the "Choice of energy supplier" example from Train's "Discrete choice methods with simulation" book by using the MDC SAS procedure.

In this example 100 people are asked to choose 1 out of 4 alternatives and each individual is asked to repeat this game 12 times (some repeated it less than 12 times though).

I can not code the fact that the same person participated in more than one choice game (set of choices) which is why the results are not the ones I expected.

The code I used was the following:

proc mdc data=Train;

     model choice=V1-V6 /

     type=mxl

     mixed= (normalparm(V2-V4), lognormalparm(V5-V6))

     nchoice=4

     randnum=halton

     nsimul=100

     seed=1234;

id TASK;

run;

The choice variable takes the value 1 if the alternative (out of the four) was chosen and 0 if not. The TASK variable is a counter in the form 1,1,1,1,2,2,2,2 . . . 1195,1195,1195,1195 to code the number of sets across all 100 individuals (12 games * 100 individuals with few individuals answering less than 12 sets). I also have an ID variable showing the individual per task. So tasks 1 up to 12 were taken by individual 1, tasks 13-24 by individual 2 and so on. However, if I replace the id command with "id ID" I get an error that the Choice variable contains redundant alternatives.

Attachment
Ask a Question
Discussion stats
  • 0 replies
  • 145 views
  • 0 likes
  • 1 in conversation