**General instructions** 

The `.Rmd` source for this document will be the template for your homework submission. You must submit your completed assignment as a single html document saved as a PDF file, uploaded to eLC by **11:59p on October 23 ** using the filename `sectiontime_teamnumber_hw1.html` (e.g. `935_1_hw5.html`). 

*Notes*:
  
+ Include the name of each teammate under `author` in the `yaml`. 
+ For questions requiring analytical solutions, you can type them in using markdown math code.  Or, you can submit handwritten solutions, embedding them in the knitted document as clearly readable images.
+ For questions requiring computation, some or all of the required code is included in associated chunks. Modify chunks where and how you are directed.
+ For (almost) all questions about R Markdown, consult [The Definitive Guide](https://bookdown.org/yihui/rmarkdown/).
+ The `setup` chunk above indicates the packages required for this assignment.
+ You will find a description of the variables in the referenced dataset through the Help tab in the Plot pane of RStudio. 
- **Switch `eval` to `TRUE` in the global options command to execute code chunks**.

***

In this homework assignment, you will use data from Angrist and Krueger 1991 to estimate the effects of years of schooling on labor market outcomes. This paper uses an indicator for being born in the first quarter of the year as an instrument for years of schooling since students born in the first quarter of the year will have attended fewer years of school when they hit the compulsory schooling age.

data <- read.csv("hw5_data.csv")
str(data)
'data.frame':   816435 obs. of  9 variables:
 $ education       : int  12 12 12 16 14 12 12 12 12 7 ...
 $ log_wage        : num  6.25 5.85 6.65 6.71 6.36 ...
 $ married         : int  1 1 1 1 1 1 1 1 1 0 ...
 $ mid_atlantic    : int  0 0 0 0 0 0 0 0 0 0 ...
 $ mountain        : int  0 0 0 0 0 0 0 0 0 0 ...
 $ new_england     : int  0 0 0 0 0 0 0 0 0 0 ...
 $ quarter_of_birth: int  1 4 1 1 4 4 1 1 3 2 ...
 $ year_of_birth   : int  33 33 30 33 37 35 38 30 39 36 ...
 $ first_quarter   : int  1 0 1 1 0 0 1 1 0 0 ...
  1. First calculate the OLS estimate of the relationship between years of schooling and log wages. Why might you not trust this estimate? Discuss the potential sign of the bias using the OVB formula.
# insert command to run linear regression with robust standard errors here
# Estimate the OLS model
ols <- lm(log_wage ~ education, data = data)

# Display coefficients with robust SEs (HC1 = heteroskedasticity-consistent)
summary(lm_robust(log_wage ~ education, data = data, se_type = "HC1"))

Call:
lm_robust(formula = log_wage ~ education, data = data, se_type = "HC1")

Standard error type:  HC1 

Coefficients:
            Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper     DF
(Intercept)  5.05223  0.0035331  1430.0        0  5.04531  5.05916 816433
education    0.05937  0.0002578   230.3        0  0.05887  0.05988 816433

Multiple R-squared:  0.07905 ,  Adjusted R-squared:  0.07905 
F-statistic: 5.303e+04 on 1 and 816433 DF,  p-value: < 2.2e-16

Answer

The OLS results show that each additional year of education raises log wages by about 5.9%, indicating a strong positive relationship between schooling and earnings. However, this estimate likely overstates the true causal effect because education is correlated with unobserved traits such as ability, ambition, or family background, which also affect wages. According to the Omitted Variable Bias (OVB) formula, if these omitted factors are positively related to both education and wages, the estimated coefficient is biased upward—meaning the OLS estimate captures not only the return to schooling but also the influence of these unobserved characteristics.

  1. Now, you decide you use an instrumental variables approach and instrument for education using quarter of birth. What assumptions do you need for this to be a valid strategy?

Answer

For quarter of birth to be a valid instrument for education, two key assumptions must hold: relevance and exogeneity. First, the relevance assumption requires that quarter of birth be correlated with years of schooling — meaning that a person’s birth quarter has a measurable effect on how much education they complete. In this context, individuals born early in the year typically start school at an older age and may reach the compulsory schooling age with fewer completed years of education, satisfying instrument relevance. Second, the exogeneity (or exclusion restriction) assumption requires that quarter of birth affects wages only through its impact on education, not through any other channel. In other words, the quarter in which someone is born should have no direct effect on their earnings or be correlated with unobserved factors (like ability, family background, or health) that also influence wages. If both assumptions hold, quarter of birth can serve as a valid instrument, allowing us to isolate the causal effect of education on wages.

  1. Write down and estimate the first stage equation. Report the main coefficient estimate in a sentence. Store your predicted values.
# insert command to estimate the first stage regression here 
first_stage <- lm(education ~ first_quarter, data = data)
educ_hat <- predict(first_stage)
summary(first_stage)

Call:
lm(formula = education ~ first_quarter, data = data)

Residuals:
    Min      1Q  Median      3Q 
-13.273  -1.272  -1.173   2.728 
    Max 
  6.827 

Coefficients:
               Estimate Std. Error
(Intercept)   13.272459   0.003984
first_quarter -0.099587   0.008062
              t value Pr(>|t|)    
(Intercept)   3331.18   <2e-16 ***
first_quarter  -12.35   <2e-16 ***
---
Signif. codes:  
  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
  ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.13 on 816433 degrees of freedom
Multiple R-squared:  0.0001868, Adjusted R-squared:  0.0001856 
F-statistic: 152.6 on 1 and 816433 DF,  p-value: < 2.2e-16

Answer

The first stage equation is

\[ education_i = \alpha_0 + \alpha_1 \text{first\_quarter}_i + u_i \]

The estimated coefficient on first_quarter is –0.0996, meaning that individuals born in the first quarter of the year complete about 0.10 fewer years of education on average compared to those born in other quarters. This negative and statistically significant relationship confirms that quarter of birth is a relevant instrument for education. The predicted values of education from this regression were stored in the object educ_hat for use in the second-stage analysis.

  1. Write down and estimate the reduced form equation. Report the main coefficient estimate in a sentence.
reduced_form <- lm(log_wage ~ first_quarter, data = data)
summary(reduced_form)

Call:
lm(formula = log_wage ~ first_quarter, data = data)

Residuals:
    Min      1Q  Median      3Q 
-8.1814 -0.2552  0.0824  0.3475 
    Max 
 5.3856 

Coefficients:
                Estimate Std. Error
(Intercept)    5.8396114  0.0008415
first_quarter -0.0032298  0.0017027
               t value Pr(>|t|)    
(Intercept)   6939.821   <2e-16 ***
first_quarter   -1.897   0.0578 .  
---
Signif. codes:  
  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
  ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.661 on 816433 degrees of freedom
Multiple R-squared:  4.407e-06, Adjusted R-squared:  3.182e-06 
F-statistic: 3.598 on 1 and 816433 DF,  p-value: 0.05785
  1. Using your answers in 3) and 4), report the Wald estimate of the relationship between education and wages.

Answer

The reduced-form equation is:

\[ \log(wage)_i = \pi_0 + \pi_1 \text{first\_quarter}_i + v_i \]

The estimated coefficient on first_quarter is –0.00323, indicating that individuals born in the first quarter of the year earn about 0.3% lower wages on average compared to those born in other quarters. This relationship is marginally significant (p ≈ 0.058), consistent with the idea that being born earlier in the year slightly reduces schooling and, consequently, earnings.

The negative sign aligns with the first-stage result—since those born in the first quarter obtain less education on average, they also tend to earn slightly less—supporting the logic behind the instrumental variables approach.

  1. To estimate this using 2SLS, write down the second stage equation. Estimate this using your predicted values from 3).
# insert command to estimate the second stage regression here
second_stage <- lm(___ ~ educ_hat)

Answer

  1. Now, use the ivreg command to direct estimate this effect. Compare this estimate to your OLS estimate in 1).
iv = ivreg(_____~ _______ | _______ ,data = data)
summary(iv)

Answer

  1. Now, add control variables to your IV regression. How do these change your results?
iv2 = ivreg(_____~ _______ | _______ ,data = data)
summary(iv2)

Answer

  1. The relationship between quarter of birth and years of schooling should only hold for those who are affected by r compulsory school laws. Estimate a regression that tests whether there is a relationship between quarter of birth and years of schooling for those who have at least a college education (16 years of schooling). What do you find?
data_16 = subset(data, education > 16)
# Insert regression here 

Answer

  1. Someone now tells you that quarter of birth is related to parental income. Does this change how you feel about your IV analysis?

Answer

LS0tCnRpdGxlOiB8CiAgICB8IEVDT04gNzcxMCAKICAgIHwgSG9tZXdvcmsgNTogSW5zdHJ1bWVudGFsIFZhcmlhYmxlcyAKI2F1dGhvcjoKIy0gIlRlYW0gbWVtYmVyIDEiCiMtICJUZWFtIG1lbWJlciAyIgojLSAiVGVhbSBtZW1iZXIgMyIKIy0gIlRlYW0gbWVtYmVyIDQiCm91dHB1dDoKIGh0bWxfbm90ZWJvb2sKdXJsY29sb3I6IGJsdWUKLS0tCgpgYGB7ciBzZXR1cCwgaW5jbHVkZT1GQUxTRX0KCiMgQXR0YWNoIHBhY2thZ2VzCmxpYnJhcnkodGlkeXZlcnNlKSAgICAgCmxpYnJhcnkoZ2dwbG90MikgICAgICAgCmxpYnJhcnkobW9kZWxzdW1tYXJ5KSAgCmxpYnJhcnkodnRhYmxlKSAgICAgICAKbGlicmFyeShBRVIpIApsaWJyYXJ5KGVzdGltYXRyKQoKIyBTZXQgZ2xvYmFsIG9wdGlvbnM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