Description
For this problem set you have to use the data in the ascii file yogurt 2018.txt. The data consists of observations on 429 households making 2567 yogurt purchases. They purchase each time one of three brands. The five variables in the data set are, (i) the household id, running from 1 to 430, (ii) the choice made by the household, running from 1 to 3, (iii) the price for that household when they made their decision, in cents, of yogurt brand 1, (iv) the price, in cents, of yogurt brand 2, (v) the price, in cents, of yogurt brand 3.
Let j index the choice, running from 1 to 3, t index the purchase, running from 1 to T_{i}, and i the household, running from 1 to 429. The number of purchases made by each household diﬀers. For example, the first two purchases come from household 1, the next two from household 2, and the next eight from the third household.
We focus on a discrete choice model where the utility for individual i associated with choice j, in purchase t is
Uijt = αj + β · Pijt + ijt,
where P_{ijt} is the price of brand j for household i at purchase time t. We assume the ε_{ijt} are independent across time, choice and household, with an extreme value distribution. Normalize α_{1} = 0, so that there are three free parameters, α_{2}, α_{3}, and β .

First, calculate the mean price for each brand, by the choice made. That is, calculate the average price of brand 1, 2 and 3 for households choosing brand 1, calculate the average price of brand 1, 2 and 3 for households choosing brand 2, and calculate the average price of brand 1, 2 and 3 for households choosing brand 3. Do the patterns
2 
make sense? That is, are the prices for brand j lowest among the households choosing brand j?

Next we want to estimate the conditional logit model. Because of the independence assumption on the ε_{ijt}, we can ignore the fact that some purchases come from the same household, and the likelihood function is
L(α_{2}, α_{3}, β) =

N
^{T}i
Y Y 1Y_{ijt} =1 · exp(β Pi1t) + 1Y_{ijt} =2 · exp(β Pi2t + α2) + 1Y_{ijt} =2 · exp(β Pi3t + α3)
i=1 t=1
exp(β P_{i1t}) + exp(β P_{i2t} + α_{2}) + exp(β P_{i3t} + α_{3})
First show that at
β
−0.0400
α_{2}
=
0.5000
α_{3}
−1.0000
the log likelihood function is equal to 2660.1.

Calculate the analytic first derivatives of the log likelihood function at these values for the parameters. Hint: the first derivative with respect to β is 6948.8.

Calculate the analytic second derivatives with respect to the parameters. Hint: the second derivative with respect to β is approximately 505130.

Next, use the NewtonRahpson algorithm to find the maximum likelihood estimators for β , α_{2}, and α_{3}.

Next we explore a random coeﬃcients version of the conditional logit model. Rather than use continuous mixtures, as is more common in the literature, we use a computationally simpler version with a binary mixture. We will let the coeﬃcient on price vary by household. Thus, we model the latent utility as
Uijt = αj + βi · Pijt + ijt,
3 
where
β_{i} ∈ {β_{L}, β_{H} }, with pr(β_{i} = β_{L}) = π = 0.4.
(More generally we may want to estimate the mixture probability π, but we wont do that here.)
Show that the likelihood function for this mixture model is

N
L(α_{2}, α_{3}, β_{L}, β_{H} , π) = ^{Y}
i=1
T_{i}
1Y_{ijt} =1 · exp(βLPi1t) + 1Y_{ijt} =2 · exp(βLPi2t + α2) + 1Y_{ijt} =2 · exp(βLPi3t + α3)
π ·
Y
t=1
exp(β_{L}P_{i1t}) + exp(β_{L}P_{i2t} + α_{2}) + exp(β_{L}P_{i3t} + α_{3})
T_{i}
1_{Y}_{ijt} _{=1} · exp(β_{H} P_{i1t}) + 1_{Y}_{ijt} _{=2} · exp(β_{H} P_{i2t} + α_{2}) + 1_{Y}_{ijt} _{=2} · exp(β_{H} P_{i3t} + α_{3})
+(1−π)·^{Y}
.
exp(β_{H} P_{i1t}) + exp(β_{H} P_{i2t} + α_{2}) + exp(β_{H} P_{i3t} + α_{3})
t=1
7. Plot the log likelihood function, for π = 0.4, at

α_{2}
αˆ_{2}
=
,
α_{3}
ˆ
αˆ_{3}
β_{L}
β − c
β_{H}
ˆ
+ c
β
as a function of c, from c = 0 to c = 0.2.
Compare the value of the log likelihood function at the value of c that maximimes it with the value at c = 0. Does it appear that allowing for the heterogeneity in price sensitivity is important?

Estimate the random eﬀects model using the EM algorithm. Report parameter estimates for α_{2}, α_{3}, β_{L}, and β_{H} .