DATA Step, Macro, Functions and more

Creating a dataset for a mixed logit model

Reply
Frequent Contributor
Posts: 113

Creating a dataset for a mixed logit model

Hello,

I would like to set a dataset to perform a mixed logit model where the independent variables are characteristics of the alternatives. Because I have a very large number of possible alternatives, I have to pick a sample (in the following example, the number of the sample is 5) among the whole initial dataset (which contains one line per individual).

Thus, the final dataset should look like this:

NO_IND

NO_ALT

CHOICE

X1

X2

X3

Z1

1

83868

1

4

4

1

1

1

97677

0

1

4

4

1

1

523

0

2

4

3

1

1

66927

0

2

3

5

1

1

192

0

1

5

1

1

2

5245

1

6

5

3

0

2

50774

0

2

1

4

0

2

73691

0

5

1

1

0

2

78395

0

6

2

2

0

2

1083

0

2

2

5

0

3

60516

1

4

0

1

1

3

94551

0

5

2

5

1

3

36227

0

4

2

3

1

3

131

0

6

4

3

1

3

54111

0

4

5

5

1

4

61115

1

1

3

2

0

4

88923

0

5

0

3

0

4

36912

0

1

2

5

0

4

94157

0

3

3

1

0

4

26647

0

6

2

3

0

The Xs are the characteristics of the alternatives (NO_ALT) and the Z is a characteristic of the individual (NO_IND). How doing setting this? I’m pretty sure there is something with the SQL procedure, but I never used it before, so if someone could help me, it would be very appreciated.

Also, if possible, the probability for an alternative to be picked up in the sample should depend of the weight variable which is present in the database. Otherwise, I think that the estimated parameters would be biased. Is it possible?

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