ps2 solutions 2012

13
Econometrics II, Solutions to PS2, Summer 2012. Page: 1 Problem 1. y * i = x i β + i where i follows N (02 i ) and σ 2 i = γ 0 + γ 1 x 2 i We observe x i and y i = 1(y * i > 0). We are supposed to write down the log- likelihood function of the model, in terms of the parameters γ 0 , γ 1 and β . This is a probit model with heteroscedasticity, where σ 2 i is known function of x i . The likelihood function is L = Q N 1 (Probability of observing y i ). Prob(y i =1|x i ) = Prob(y * i > 0|x i )= Prob( i > -x i β |x i )= = 1 - Φ -x i β σ i =1 - Φ -x i β p γ 0 + γ 1 x i 2 ! , where Φ is the standard normal CDF. In the similar way, Prob(y i =0|x i ) = Prob(y * i 0|x i )= Prob( i ≤-x i β |x i )= = Φ( -x i β σ i ) = Φ( -x i β p γ 0 + γ 1 x i 2 ). The log-likelihood function is logL = N X 1 [y i ln(Prob(y i = 1)) + (1 - y i ) ln(Prob(y i = 0))] = = N X 1 y i ln(1 - Φ( -x i β p γ 0 + γ 1 x i 2 )) + N X 1 (1 - y i ) ln(Φ( -x i β p γ 0 + γ 1 x i 2 )). Then we maximize this logL with respect to parameters γ 0 , γ 1 and β . Problem 2 You have a cross-sectional sample of households with the in- formation about whether the household has an internet connection or not, and whether it resides in an urban or a rural area. You are asked to estimate the effect of the type of the residence area on the probability of having an internet connection. Problem 2a Write down an underlying latent variable model of the propensity of having an internet connection. Solution: y * i = α + βx i + ε i , where y i - propensity of having an internet connection; x i - indicator variable:

Upload: marko-petrovic

Post on 26-Oct-2014

53 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 1

Problem 1. y∗i = xiβ + εi where εi follows N(0, σ2i ) and σ2

i = γ0 + γ1x2i

We observe xi and yi = 1(y∗i > 0). We are supposed to write down the log-likelihood function of the model, in terms of the parameters γ0, γ1 and β.This is a probit model with heteroscedasticity, where σ2

i is known functionof xi. The likelihood function is L =

∏N1 (Probability of observing yi).

Prob(yi = 1|xi) = Prob(y∗i > 0|xi) = Prob(εi > −xiβ|xi) =

= 1− Φ(−xiβσi

)= 1− Φ

(−xiβ√γ0 + γ1xi2

),

where Φ is the standard normal CDF. In the similar way,

Prob(yi = 0|xi) = Prob(y∗i ≤ 0|xi) = Prob(εi ≤ −xiβ|xi) =

= Φ(−xiβσi

) = Φ(−xiβ√γ0 + γ1xi2

).

The log-likelihood function is

logL =N∑1

[yi ln(Prob(yi = 1)) + (1− yi) ln(Prob(yi = 0))] =

=N∑1

yi ln(1− Φ(−xiβ√γ0 + γ1xi2

)) +N∑1

(1− yi) ln(Φ(−xiβ√γ0 + γ1xi2

)).

Then we maximize this logL with respect to parameters γ0, γ1 and β.

Problem 2 You have a cross-sectional sample of households with the in-formation about whether the household has an internet connection or not,and whether it resides in an urban or a rural area. You are asked to estimatethe effect of the type of the residence area on the probability of having aninternet connection.

Problem 2a Write down an underlying latent variable model of thepropensity of having an internet connection.

Solution:y∗i = α+ β xi + εi,

where yi - propensity of having an internet connection;xi - indicator variable:

Page 2: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 2

{xi = 1 if urban area,xi = 0 if rural area.

Problem 2b Propose an estimation method: state the assumptionsyou make and write down the formula defining your estimator. Which pa-rameters of your model are identified?

Solution: Assume that εi ∼ N(0, σ2), we observe xi and yi = 1 wheny∗i > µ.

Pr(yi = 1 | xi) = Pr(y∗i > µ | xi) = Pr(α+ β xi + εi > µ) =

= Pr(εiσ>µ− ασ− β

σxi

)=

= 1− Φ(µ− ασ− β

σxi

)Pr(yi = 0 | xi) = Φ

(µ− ασ− β

σxi

)lnL =

N∑i=1

1(yi = 1) · ln[1− Φ

(µ− ασ− β

σxi

)]+

+N∑i=1

1(yi = 0) · ln[Φ(µ− ασ− β

σxi

)]γ = (γ1, γ2) = argmin︸ ︷︷ ︸

γ1,γ2

lnL

γ1 = µ−ασ , γ2 = β

σ only these two parameters are identified.(If we normalize µ = 0, σ = 1 → α, β).

Problem 2c Derive the expression for the average effect of living inan urban area on the probability of having an internet connection.

Solution: APE(xi) =∑Ni=1[Φ(α−µσ +β

σ )−Φ(α−µσ )]

N

Problem 3. In an ordered probit model with four outcomes, you obtainthe following results: y∗ = 10 + 50x1 − 80x2, where σ = 100, and thethresholds are µ0 = −∞, µ1 = 100, µ2 = 200, µ3 = 300, and µ4 =∞

Page 3: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 3

Problem 3a. (See Stata code for the calculation details)

Prob(µ2 < y∗i ≤ µ3|xi) = Φ(µ3 − xiβ

σ

)− Φ

(µ2 − xiβ

σ

)∂Prob(µ2 < y∗i ≤ µ3|xi)

∂x2= −β2

σ

(µ3 − xiβ

σ

)− ϕ

(µ2 − xiβ

σ

)]= [at x1 = 1 and x2 = 1, if we plug in the numbers]

=80100

(300 + 20

100

)− ϕ

(200 + 20

100

)]= −0.0264724

∂Prob(200 < y∗i ≤ 300|x1 = 1, x2 = 2)∂x2

=80100

(300 + 100

100

)− ϕ

(200 + 100

100

)]= −0.00343841

If x2 is treated as a discrete variable, the corresponding effect is the following:

Prob(200 < y∗i ≤ 300|x1 = 1, x2 = 2)−Prob(200 < y∗i ≤ 300|x1 = x2 = 1) =

= [Φ(300− xiβ

σ|x1 = 1, x2 = 2)− Φ(

200− xiβσ

|x1 = 1, x2 = 2)]−

−[Φ(300− xiβ

σ|x1 = x2 = 1)− Φ(

200− xiβσ

|x1 = x2 = 1)] =

= [Φ(300 + 100

100)−Φ(

200 + 100100

)]−[Φ(300 + 20

100)−Φ(

200 + 20100

)] = −0.01189808

Problem 3b.

Prob(y∗i < µ1|xi) = Φ(µ1 − xiβ

σ)

∂Prob(y∗i < µ1|xi)∂x1

= −β1

σϕ(µ1 − xiβ

σ)

= [at x1 = 1 and x2 = 1, if we plug in the numbers]∂Prob(y∗i < 100|x1 = x2 = 1)

∂x1= − 50

100ϕ(

100 + 20100

) = −0.09709303

∂Prob(y∗i < 100|x1 = 2, x2 = 1)∂x1

= − 50100

ϕ(100− 30

100) = −0.15612697

Page 4: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 4

If x1 is treated as a discrete variable, the corresponding effect is the following:

Prob(y∗i < 100|x1 = 2, x2 = 1)− Prob(y∗i < 100|x1 = x2 = 1) =

= Φ(100− xiβ

σ|x1 = 2, x2 = 1)− Φ(

100− xiβσ

|x1 = x2 = 1) =

= Φ(100− 30

100)− Φ(

100 + 20100

) = −0.12689398

Problem 4a. The distribution of individuals in the sample across thedifferent values of pctstck is presented in Table 1: 34.5% of individualsprefer to hold only bonds, 37.6% are mixing bonds and stocks, and the rest,27.9%, are the most risk-loving individuals, who hold only stocks in theirportfolio.

Table 1: Distribution of pctstckpctstck Freq. Percent Cum.

0 78 34.51 34.5150 85 37.61 72.12100 63 27.88 100

Total 226 100

Problem 4b. Estimate a linear model for pctstck, where the explana-tory variables are choice, age, educ, female, black, married, finc25, . . . ,finc101, wealth89, and prftshr. Why might you compute heteroskedasticity-robust standard errors?

As we see in Table 2 the robust standard errors are not different fromthe usual ones, however, the overall fit of the model has improved. As thedependent variable pctstck takes on only three values {0, 50, 100}, the errorterms in the linear model are heteroskedastic, that is why we might computeheteroskedasticity-robust standard errors.

Consider a general LPM model of the form y∗i = β1+β2x2i+. . .+βkxki+ui, where, under the assumption E(ui|xi) = 0, E(yi) = β1 + β2x2i + . . . +βkxki. However, instead of observing y∗i we observe yi, which takes on the

Page 5: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 5

values {0, 50, 100}. From the expected value definition:

E(yi|xi) = 0 · P (yi = 0|xi) + 50 · P (yi = 50|xi) + 100 · P (yi = 100|xi) == 50 · P (yi = 50|xi) + 100 · P (yi = 100|xi)

E(u2i |xi) = E[yi − E(yi|xi)|xi]2 = E(y2

i |xi)− [E(yi|xi)]2

= [502 · P (yi = 50|xi) + 1002 · P (yi = 100|xi)]−−[50 · P (yi = 50|xi) + 100 · P (yi = 100|xi)]2 →→ heteroskedasticity.

Table 2: Estimation results: OLSVariable Coefficient (Std. Err.) (Robust Std. Err.)choice 12.048 (6.298) (5.994)age -1.626 (0.775) (0.833)educ 0.754 (1.207) (1.172)female 1.303 (7.164) (7.149)black 3.967 (9.783) (8.975)married 3.303 (7.998) (8.370)finc25 -18.186 (14.120) (16.005)finc35 -3.925 (14.486) (15.863)finc50 -8.129 (14.342) (15.376)finc75 -17.579 (16.078) (16.680)finc100 -6.746 (15.791) (16.748)finc101 -28.344 (17.905) (16.578)wealth89 -0.003 (0.012) (0.011)prftshr 15.808 (7.333) (8.108)Intercept 134.116 (55.705) (58.873)N 194R2 0.1F (14,179) 1.418 2.15

Problem 4c. Estimate the model from part (a) by ordered probit. Es-timate E(pctstck|x) for a single, non-black female with 12 years of educationwho is 60 years old. Assume she has net worth (in 1989) equal to $150,000and earns $45,000 a year, and her plan is not profit sharing. Compare thiswith the estimate of E(pctstck|x) from the linear model.

Page 6: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 6

The results of the ordered probit estimation are given in Table 3. Notethat you should compute the expected value of pctstck conditional on thevalues of the RHS variables but you are not given the value of the variablechoice. This is why you need to compute the two expected values separately.We compute the E(pctstck|x) for choice = 1 and choice = 0 respectivelyusing oprobit model in the following steps (refer to Stata code for the esti-mation details):

• Recall that E(pctstck|x) = 50 · P (yi = 50|xi) + 100 · P (yi = 100|xi)

• We estimate probabilities:

Prob(pctstck = 50|x, choice = 0) = 0.373,P rob(pctstck = 100|x, choice = 0) = 0.193,P rob(pctstck = 50|x, choice = 1) = 0.395,P rob(pctstck = 100|x, choice = 1) = 0.310.

• Estimate expected values:E(pctstck|x, choice = 0) = 37.971,E(pctstck|x, choice = 1) = 50.746.

We may as well compare the two values, which gives us the partial effectof choice on E(pctstck|x): E(pctstck|x, choice = 1)−E(pctstck|x, choice =0) = 12.776. The effect of possibility to choose the method of investingresults in about 12.776 percentage points holding more stocks for the givenperson.

For LPM E(pctstck|x) = xβ, E(pctstck|x, choice = 1) = 50.423 andE(pctstck|x, choice = 0) = 38.375, the effect – βchoice = 12.048. The effectof choice obtained from OPM is bigger than that obtained from LPM.

Problem 4d. Answer question (c) using an ordered logit model andcompare.

The results of the ordered logit estimation are given in Table 4. Againwe estimate E(pctstck|x) in the following steps:

• We estimate probabilities:

Prob(pctstck = 50|x, choice = 0) = 0.378,P rob(pctstck = 100|x, choice = 0) = 0.201,P rob(pctstck = 50|x, choice = 1) = 0.400,P rob(pctstck = 100|x, choice = 1) = 0.312.

Page 7: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 7

Table 3: Estimation results : oprobitVariable Coefficient (Std. Err.)

choice 0.371 (0.184)age -0.050 (0.023)educ 0.026 (0.035)female 0.046 (0.206)black 0.093 (0.282)married 0.094 (0.233)finc25 -0.578 (0.423)finc35 -0.135 (0.431)finc50 -0.262 (0.427)finc75 -0.566 (0.478)finc100 -0.228 (0.469)finc101 -0.864 (0.529)wealth89 0.000 (0.000)prftshr 0.482 (0.216)cut1 -3.087 (1.624)cut2 -2.054 (1.619)N 194Log-likelihood -201.987χ2

(14) 20.768

Page 8: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 8

• Estimate expected values:E(pctstck|x, choice = 0) = 39.032,E(pctstck|x, choice = 1) = 51.239.

The effect of choice is: E(pctstck|x, choice = 1) − E(pctstck|x, choice =0) = 12.206. Therefore the effect of choice for the given person is about12.206 percentage points more in stock, which is between those obtainedusing LPM and OPM.

Table 4: Estimation results : ologitVariable Coefficient (Std. Err.)

choice 0.588 (0.304)age -0.087 (0.039)educ 0.051 (0.058)female 0.058 (0.343)black 0.123 (0.459)married 0.104 (0.394)finc25 -1.004 (0.739)finc35 -0.237 (0.742)finc50 -0.461 (0.732)finc75 -1.026 (0.811)finc100 -0.450 (0.799)finc101 -1.390 (0.879)wealth89 0.000 (0.001)prftshr 0.799 (0.375)cut1 -5.333 (2.767)cut2 -3.636 (2.752)N 194Log-likelihood -201.923χ2

(14) 20.895

Problem 4e. Use the ordered probit and ordered logit models to pre-dict for each individual the most likely outcome of the dependent variable.Compare the (unconditional) distribution of individuals across the predictedoutcomes based on the two models with the actual distribution.

The comparison is presented in Table 5 (see STATA code for the details).We see that ordered probit and logit models predict pretty well the relativedistribution of outcomes, although they tend to overstate the medium out-come. At the same time, the estimated models are able to correctly predict

Page 9: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 9

the outcomes only in 50% or less cases, as suggested by the diagonal elementsin Tables 6 and 7. Such performance is not surprising given the relativelypoor fit of the model (low pseudo R2).

Table 5: Distribution of actual and predicted pctstck

Actual Predicted OPM Predicted OLMpctstck Freq./Perc. Freq./Perc. Freq./Perc.

0 78/34.51 65/33.51 64/32.9950 85/37.61 81/41.75 83/42.78100 63/27.88 48/24.74 47/24.23

Total 226/100 194/100 194/100

Table 6: Correctly predicted pctstck, OPMpctstck prob=0 pctstck prob=50 pctstck prob=100

pctstck=0 33 / 51.56% 25 / 39.06% 6 / 9.38%pctstck=50 21 / 29.17% 31 / 43.04% 20 / 27.78%pctstck=100 11 / 18.97% 25 / 43.1% 22 / 37.93%

Table 7: Correctly predicted pctstck, OLMpctstck logit=0 pctstck logit=50 pctstck logit=100

pctstck=0 33 / 51.56% 25 / 39.06% 6 / 9.38%pctstck=50 19 / 26.39% 34 / 47.22% 19 / 26.39%pctstck=100 12 / 20.69% 24 / 41.38% 22 / 37.93%

Problem 4f. Consider the ordered probit model from above. Basedon the estimated coefficient of prftshr, what sign do you expect the effectof having a profit-sharing plan (rather than not) to have on the probabilityof having a mostly-bonds portfolio, a mixed-portfolio and a mostly-stocksportfolio respectively? Compute the average partial effect of having a profit-sharing plan on these three probabilities.

The estimated coefficient on prftshr is positive and significant at the5% level, this means that having a profit sharing plan should decrease theprobability of having pctstck=0 and increase the probability of having pct-stck=100. The effect on pctstck=50 is ambiguous and has to be determinedempirically. The average partial effects of having a profit-sharing plan on

Page 10: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 10

probabilities of three outcomes are -0.1521, -0.0137 and 0.1658 correspond-ingly, which confirms our prior conjectures and reveals that the effect ofhaving a profit sharing plan on pctstck=50 is negative.

STATA CODES

* ========================================================================

* Problem 3

* ========================================================================

* 3a)

* ========================================================================display 0.8*(normalden(320/100) - normalden(220/100)) /* derivative w.r.t. x_2 */display 0.8*(normalden(400/100) - normalden(300/100)) /* derivative w.r.t. x_2 */display (normal(400/100) - normal(300/100)) - (normal(320/100) - normal(220/100))/* discrete change in x_2 */

* ========================================================================

* 3b)

* ========================================================================display -0.5 * normalden(120/100) /* derivative w.r.t. x_1 */display -0.5 * normalden(70/100) /* derivative w.r.t. x_1 */display normal(70/100) - normal(120/100)/* discrete change in x_1 */

* =================================================================

* Problem 4

* =================================================================clear allset more offuse pension.dta

* ========================================================================

* a) Explore the dependent variable pctstck

* ========================================================================

tab pctstck

* ========================================================================

* b) LPM with usual and robust st. errors

* ========================================================================

reg pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr

reg pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr, robust

reg pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr, r cluster(id)

Page 11: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 11

* ========================================================================

* c) Estimate the model from part (b) by ordered probit

* ========================================================================

* for choice = 1mat A=(1, 60, 12, 1, 0, 0, 0, 0, 1, 0, 0, 0, 150, 0)

* for choice = 0mat B=(0, 60, 12, 1, 0, 0, 0, 0, 1, 0, 0, 0, 150, 0)

* oprobitoprobit pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr

qui mfx, predict(p outcome(#1)) at(A)scalar prob1_0=e(Xmfx_y)qui mfx, predict(p outcome(#2)) at(A)scalar prob1_50=e(Xmfx_y)qui mfx, predict(p outcome(#3)) at(A)scalar prob1_100=e(Xmfx_y)

di "Prob(pctstck = 0; choice = 1)" prob1_0 "Prob(pctstck = 50; choice = 1)" ///prob1_50 "Prob(pctstck = 100; choice = 1)" prob1_100

scalar expect_prob1=0*prob1_0+50*prob1_50+100*prob1_100

qui mfx, predict(p outcome(#1)) at(B)scalar prob0_0=e(Xmfx_y)qui mfx, predict(p outcome(#2)) at(B)scalar prob0_50=e(Xmfx_y)qui mfx, predict(p outcome(#3)) at(B)scalar prob0_100=e(Xmfx_y)

di "Prob(pctstck = 0; choice = 0)" prob0_0 "Prob(pctstck = 50; choice = 0)"///prob0_50 "Prob(pctstck = 100; choice = 0)" prob0_100

scalar expect_prob0=0*prob0_0+50*prob0_50+100*prob0_100

* OLSqui reg pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr

qui mfx, at(A)scalar expect_lin1=e(Xmfx_y)qui mfx, at(B)scalar expect_lin0=e(Xmfx_y)

display "E(pctstck|x,choice=1 ) = "expect_prob1 "E(pctstck|x,choice=0) = "expect_prob0

display expect_lin1

Page 12: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 12

display expect_lin0

di "Effect of choice (Ordered Logit) : " expect_prob1-expect_prob0di expect_lin1-expect_lin0

* ========================================================================

* d) Estimate the model from part (b) by ordered logit

* ========================================================================ologit pctstck choice age educ female black married finc25 finc35 finc50 finc75 ///finc100 finc101 wealth89 prftshr

qui mfx, predict(p outcome(#1)) at(A)scalar log1_0=e(Xmfx_y)qui mfx, predict(p outcome(#2)) at(A)scalar log1_50=e(Xmfx_y)qui mfx, predict(p outcome(#3)) at(A)scalar log1_100=e(Xmfx_y)

di "Prob(pctstck = 0; choice = 1)" log1_0 "Prob(pctstck = 50; choice = 1)" log1_50 ///"Prob(pctstck = 100; choice = 1)"log1_100

scalar expect_log1=0*log1_0+50*log1_50+100*log1_100

qui mfx, predict(p outcome(#1)) at(B)scalar log0_0=e(Xmfx_y)qui mfx, predict(p outcome(#2)) at(B)scalar log0_50=e(Xmfx_y)qui mfx, predict(p outcome(#3)) at(B)scalar log0_100=e(Xmfx_y)

di "Prob(pctstck = 0; choice = 0)"log0_0 "Prob(pctstck = 50; choice = 0)" log0_50 ///"Prob(pctstck = 100; choice = 0)" log0_100

scalar expect_log0=0*log0_0+50*log0_50+100*log0_100

di "E(pctstck|x,choice=1) = " expect_log1 "E(pctstck|x,choice=0) = " expect_log0di "Effect of choice (Ordered Logit) : " expect_log1-expect_log0

* ========================================================================

* e) Compare the (unconditional) distribution of individuals across the predicted

* outcomes based on the two models with the actual distribution

* ========================================================================

qui oprobit pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr

predict p1 p2 p3gen maxp=max(p1, p2, p3)gen pctstck_prob=0 if p1==maxp & p1!=.

Page 13: PS2 Solutions 2012

Econometrics II, Solutions to PS2, Summer 2012. Page: 13

replace pctstck_prob=50 if p2==maxp & p2!=.replace pctstck_prob=100 if p3==maxp & p3!=.tab pctstck_prob

qui ologit pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 prftshr

predict l1 l2 l3gen maxl=max(l1, l2, l3)gen pctstck_log=0 if l1==maxl & l1!=.replace pctstck_log=50 if l2==maxl & l2!=.replace pctstck_log=100 if l3==maxl & l3!=.tab pctstck_log

tab pctstck pctstck_prob, rowtab pctstck pctstck_log, rowtab pctstck_prob pctstck_log, row

drop p1 p2 p3 l1 l2 l3

* ========================================================================

* f) the average partial effects of having a profit-sharing plan on

* three probabilities

* ========================================================================qui oprobit pctstck choice age educ female black married finc25 finc35 finc50 ///finc75 finc100 finc101 wealth89 i.prftshr

margins, dydx(prftshr) predict(outcome(0))margins, dydx(prftshr) predict(outcome(50))margins, dydx(prftshr) predict(outcome(100))