Assignment 5_Instrumental Variables

Author

Shirin Saleh

Published

April 21, 2025

Read “card” dataset into R program. It contains data on 3,010 observations from the National Longitudinal Study (NLS) of young men. Like other longitudinal surveys initiated in the mid 1960s, the NLSYM was not a random sample of US population, rather men from neighborhood with high concentartion of non-white residents were over sampled. And this data contains a relatively high fraction of men form the southern region and high fraction of Black people. Also, there was this Standard Metropolitan Statistical Area (smsa) variable that they used as a proxy for urban and rurality

Load the card data

# A tibble: 6 × 34
     id nearc2 nearc4  educ   age fatheduc motheduc weight momdad14 sinmom14
  <dbl>  <dbl>  <dbl> <dbl> <dbl>    <dbl>    <dbl>  <dbl>    <dbl>    <dbl>
1     2      0      0     7    29       NA       NA 158413        1        0
2     3      0      0    12    27        8        8 380166        1        0
3     4      0      0    12    34       14       12 367470        1        0
4     5      1      1    11    27       11       12 380166        1        0
5     6      1      1    12    34        8        7 367470        1        0
6     7      1      1    12    26        9       12 380166        1        0
# ℹ 24 more variables: step14 <dbl>, reg661 <dbl>, reg662 <dbl>, reg663 <dbl>,
#   reg664 <dbl>, reg665 <dbl>, reg666 <dbl>, reg667 <dbl>, reg668 <dbl>,
#   reg669 <dbl>, south66 <dbl>, black <dbl>, smsa <dbl>, south <dbl>,
#   smsa66 <dbl>, wage <dbl>, enroll <dbl>, kww <dbl>, iq <dbl>, married <dbl>,
#   libcrd14 <dbl>, exper <dbl>, lwage <dbl>, expersq <dbl>
spc_tbl_ [3,010 × 34] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ id      : num [1:3010] 2 3 4 5 6 7 8 9 10 11 ...
 $ nearc2  : num [1:3010] 0 0 0 1 1 1 1 1 1 1 ...
 $ nearc4  : num [1:3010] 0 0 0 1 1 1 1 1 1 1 ...
 $ educ    : num [1:3010] 7 12 12 11 12 12 18 14 12 12 ...
 $ age     : num [1:3010] 29 27 34 27 34 26 33 29 28 29 ...
 $ fatheduc: num [1:3010] NA 8 14 11 8 9 14 14 12 12 ...
 $ motheduc: num [1:3010] NA 8 12 12 7 12 14 14 12 12 ...
 $ weight  : num [1:3010] 158413 380166 367470 380166 367470 ...
 $ momdad14: num [1:3010] 1 1 1 1 1 1 1 1 1 1 ...
 $ sinmom14: num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ step14  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg661  : num [1:3010] 1 1 1 0 0 0 0 0 0 0 ...
 $ reg662  : num [1:3010] 0 0 0 1 1 1 1 1 1 1 ...
 $ reg663  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg664  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg665  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg666  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg667  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg668  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ reg669  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ south66 : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ black   : num [1:3010] 1 0 0 0 0 0 0 0 0 0 ...
 $ smsa    : num [1:3010] 1 1 1 1 1 1 1 1 1 1 ...
 $ south   : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ smsa66  : num [1:3010] 1 1 1 1 1 1 1 1 1 1 ...
 $ wage    : num [1:3010] 548 481 721 250 729 500 565 608 425 515 ...
 $ enroll  : num [1:3010] 0 0 0 0 0 0 0 0 0 0 ...
 $ kww     : num [1:3010] 15 35 42 25 34 38 41 46 32 34 ...
 $ iq      : num [1:3010] NA 93 103 88 108 85 119 108 96 97 ...
 $ married : num [1:3010] 1 1 1 1 1 1 1 1 4 1 ...
 $ libcrd14: num [1:3010] 0 1 1 1 0 1 1 1 0 1 ...
 $ exper   : num [1:3010] 16 9 16 10 16 8 9 9 10 11 ...
 $ lwage   : num [1:3010] 6.31 6.18 6.58 5.52 6.59 ...
 $ expersq : num [1:3010] 256 81 256 100 256 64 81 81 100 121 ...
 - attr(*, "spec")=
  .. cols(
  ..   id = col_double(),
  ..   nearc2 = col_double(),
  ..   nearc4 = col_double(),
  ..   educ = col_double(),
  ..   age = col_double(),
  ..   fatheduc = col_double(),
  ..   motheduc = col_double(),
  ..   weight = col_double(),
  ..   momdad14 = col_double(),
  ..   sinmom14 = col_double(),
  ..   step14 = col_double(),
  ..   reg661 = col_double(),
  ..   reg662 = col_double(),
  ..   reg663 = col_double(),
  ..   reg664 = col_double(),
  ..   reg665 = col_double(),
  ..   reg666 = col_double(),
  ..   reg667 = col_double(),
  ..   reg668 = col_double(),
  ..   reg669 = col_double(),
  ..   south66 = col_double(),
  ..   black = col_double(),
  ..   smsa = col_double(),
  ..   south = col_double(),
  ..   smsa66 = col_double(),
  ..   wage = col_double(),
  ..   enroll = col_double(),
  ..   kww = col_double(),
  ..   iq = col_double(),
  ..   married = col_double(),
  ..   libcrd14 = col_double(),
  ..   exper = col_double(),
  ..   lwage = col_double(),
  ..   expersq = col_double()
  .. )
 - attr(*, "problems")=<externalptr> 

data transformation based on the NLS dataset and data dictionary of the assignment

library(dplyr)

nls_clean <- card_data %>%
  mutate(
    nearc4 = factor(nearc4, labels = c("No", "Yes")),
    black = factor(black, labels = c("Non-Black", "Black")),
    south = factor(south, labels = c("Non-South", "South")),
    smsa = factor(smsa, labels = c("Non-Urban", "Urban")),
    region = case_when(
      reg661 == 1 ~ "NE",
      reg662 == 1 ~ "NC",
      reg663 == 1 ~ "South Atlantic",
      reg664 == 1 ~ "EN Central",
      reg665 == 1 ~ "WN Central",
      reg666 == 1 ~ "South Central",
      reg667 == 1 ~ "Mountain",
      reg668 == 1 ~ "Pacific",
      reg669 == 1 ~ "Other",
      TRUE ~ "Unknown"
    ))
# let's check the missing in each variables
colSums(is.na(nls_clean))
      id   nearc2   nearc4     educ      age fatheduc motheduc   weight 
       0        0        0        0        0      690      353        0 
momdad14 sinmom14   step14   reg661   reg662   reg663   reg664   reg665 
       0        0        0        0        0        0        0        0 
  reg666   reg667   reg668   reg669  south66    black     smsa    south 
       0        0        0        0        0        0        0        0 
  smsa66     wage   enroll      kww       iq  married libcrd14    exper 
       0        0        0       47      949        7       13        0 
   lwage  expersq   region 
       0        0        0 

Most variables have no missing data, which is excellent for regression. Overall, the dataset is mostly complete but has moderate missingness in parental education and substantial missingness in IQ.

Q1: Run some descriptive statistics in order to get a general idea of the data

Plotting the distribution of raw and log hourly wages

hist(nls_clean$wage, main = "Wage Distribution", xlab = "Hourly Wage")

hist(nls_clean$lwage, main = "Log Wage Distribution", xlab = "Log Hourly Wage")

Raw hourly wage: The distribution is right-skewed, with a long tail of high earners. Log wage distribution appears approximately normal, supporting the use of OLS regression with log wages as the outcome.

Scatterplots showing the relationship between key predictors and log wages.

library(ggplot2)

# Education vs. log wage
ggplot(nls_clean, aes(x = educ, y = lwage)) +
  geom_point(alpha = 0.3) +
  geom_smooth(method = "lm", col = "blue") +
  labs(title = "Education vs. Log Wage")
`geom_smooth()` using formula = 'y ~ x'

# Experience vs. log wage
ggplot(nls_clean, aes(x = exper, y = lwage)) +
  geom_point(alpha = 0.3) +
  geom_smooth(method = "lm", col = "darkgreen") +
  labs(title = "Experience vs. Log Wage")
`geom_smooth()` using formula = 'y ~ x'

# Experience Squared vs. log wage
ggplot(nls_clean, aes(x = expersq, y = lwage)) +
  geom_point(alpha = 0.3) +
  geom_smooth(method = "lm", col = "darkgreen") +
  labs(title = "Experience vs. Log Wage")
`geom_smooth()` using formula = 'y ~ x'

Years of schooling vs. Log Wage shows a positive linear trend. Experience vs. Log Wage is expected to show a concave (nonlinear) pattern Experience Squared vs. Log Wage helps illustrate the diminishing returns of experience on wages.

# Categorize the treatment variable (education) to group individuals based on that
nls_clean$educ_level <- cut(nls_clean$educ,
                            breaks = c(0, 11, 15, 18),
                            labels = c("Less than HS", "HS Grad", "College or More"),
                            right = TRUE,
                            include.lowest = TRUE)
table(nls_clean$educ_level)

   Less than HS         HS Grad College or More 
            497            1696             817 

Generate a descriptive summary table grouped by education level (educ_level).

This table excludes ID, raw education values, and regional dummy variables.

Characteristic Less than HS
N = 497
1
HS Grad
N = 1,696
1
College or More
N = 817
1
Near 2-year college 214 (43%) 733 (43%) 380 (47%)
Near 4_year college 279 (56%) 1,172 (69%) 602 (74%)
Age (years) 29.0 (26.0, 31.0) 27.0 (25.0, 30.0) 28.0 (26.0, 31.0)
Father's Schooling 7.0 (4.0, 9.0) 10.0 (8.0, 12.0) 12.0 (10.0, 14.0)
    Missing 187 401 102
Mother's Schooling 8.0 (5.0, 10.0) 11.0 (8.0, 12.0) 12.0 (11.0, 13.0)
    Missing 108 200 45
Weight (lb) 140,524 (99,110, 378,045) 364,640 (127,041, 397,706) 373,482 (352,463, 426,142)
momdad14 334 (67%) 1,312 (77%) 730 (89%)
sinmom14 80 (16%) 176 (10%) 47 (5.8%)
step14 17 (3.4%) 82 (4.8%) 18 (2.2%)
south66 325 (65%) 666 (39%) 256 (31%)
Race


    Non-Black 264 (53%) 1,308 (77%) 735 (90%)
    Black 233 (47%) 388 (23%) 82 (10%)
Standard Metropolitan Statistical Area(1976)


    Non-Urban 223 (45%) 465 (27%) 176 (22%)
    Urban 274 (55%) 1,231 (73%) 641 (78%)
Live in South(1976)


    Non-South 185 (37%) 1,053 (62%) 557 (68%)
    South 312 (63%) 643 (38%) 260 (32%)
Standard Metropolitan Statistical Area(1966) 256 (52%) 1,133 (67%) 566 (69%)
wage 400 (300, 549) 535 (400, 700) 635 (466, 817)
enroll 6 (1.2%) 159 (9.4%) 113 (14%)
Knowledge of the World of Work 26 (20, 32) 34 (28, 39) 39 (34, 43)
    Missing 15 25 7
IQ Score 86 (75, 94) 100 (91, 108) 113 (104, 120)
    Missing 344 475 130
Marital Status


    1 358 (72%) 1,234 (73%) 552 (68%)
    2 7 (1.4%) 7 (0.4%) 0 (0%)
    3 1 (0.2%) 1 (<0.1%) 1 (0.1%)
    4 26 (5.3%) 95 (5.6%) 34 (4.2%)
    5 23 (4.7%) 60 (3.5%) 19 (2.3%)
    6 79 (16%) 296 (17%) 210 (26%)
    Missing 3 3 1
libcrd14 178 (36%) 1,147 (68%) 696 (85%)
    Missing 5 6 2
Experience (years) 13.0 (10.0, 16.0) 8.0 (7.0, 11.0) 5.0 (3.0, 8.0)
Log Hourly Wage 5.99 (5.70, 6.31) 6.28 (5.99, 6.55) 6.45 (6.14, 6.71)
expersq 169 (100, 256) 64 (49, 121) 25 (9, 64)
Region (1966)


    EN Central 14 (2.8%) 118 (7.0%) 61 (7.5%)
    Mountain 81 (16%) 178 (10%) 72 (8.8%)
    NC 51 (10%) 265 (16%) 168 (21%)
    NE 16 (3.2%) 86 (5.1%) 38 (4.7%)
    Other 22 (4.4%) 163 (9.6%) 87 (11%)
    Pacific 5 (1.0%) 50 (2.9%) 30 (3.7%)
    South Atlantic 64 (13%) 348 (21%) 177 (22%)
    South Central 77 (15%) 156 (9.2%) 56 (6.9%)
    WN Central 167 (34%) 332 (20%) 128 (16%)
1 n (%); Median (Q1, Q3)

Q2:Estimate an OLS regression with the log of wage as the dependent variable and education as the independent variable. In another regression model, estimate the impact of education on log wage adjusting for experience, black race, living in the south, and living in a standard metropolitan statistical area.

OLS regression model (unadjusted)

# Model 1: Simple Linear Regression
# Estimate the effect of education on log wage (lwage)
model1 <- lm(lwage ~ educ, data = nls_clean)
summary(model1)

Call:
lm(formula = lwage ~ educ, data = nls_clean)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.73799 -0.27764  0.02373  0.28839  1.46080 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  5.57088    0.03883  143.47   <2e-16 ***
educ         0.05209    0.00287   18.15   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.4214 on 3008 degrees of freedom
Multiple R-squared:  0.09874,   Adjusted R-squared:  0.09844 
F-statistic: 329.5 on 1 and 3008 DF,  p-value: < 2.2e-16
exp(coef(model1))
(Intercept)        educ 
 262.665780    1.053475 

Adjusted OLS (add covariates)

# Model 2: Multiple Linear Regression
# Estimate the effect of education on lwage adjusting for experience, race, and geography:
# Model 2: Add experience, race, region, and urbanicity as controls
model2 <- lm(lwage ~ educ + exper + expersq + black + south + smsa, data = nls_clean)
summary(model2)

Call:
lm(formula = lwage ~ educ + exper + expersq + black + south + 
    smsa, data = nls_clean)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.59297 -0.22315  0.01893  0.24223  1.33190 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  4.7336643  0.0676026  70.022  < 2e-16 ***
educ         0.0740090  0.0035054  21.113  < 2e-16 ***
exper        0.0835958  0.0066478  12.575  < 2e-16 ***
expersq     -0.0022409  0.0003178  -7.050 2.21e-12 ***
blackBlack  -0.1896315  0.0176266 -10.758  < 2e-16 ***
southSouth  -0.1248615  0.0151182  -8.259  < 2e-16 ***
smsaUrban    0.1614230  0.0155733  10.365  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3742 on 3003 degrees of freedom
Multiple R-squared:  0.2905,    Adjusted R-squared:  0.2891 
F-statistic: 204.9 on 6 and 3003 DF,  p-value: < 2.2e-16
exp(coef(model2))
(Intercept)        educ       exper     expersq  blackBlack  southSouth 
113.7114764   1.0768165   1.0871894   0.9977616   0.8272639   0.8826191 
  smsaUrban 
  1.1751819 

In this adjusted OLS model, we estimated the effect of education on log hourly wages while controlling for cognitive ability (IQ), experience squared, race, region, and urban location. The coefficient for education is 0.074, indicating that each additional year of schooling is associated with approximately a 7.4% increase in log wages, holding other variables constant.

We can argue that people with more education also have other advantages, like higher motivation, better family support, or stronger abilities, that help them earn more. These things (which we often can’t measure) can confuse the results. So, part of what OLS captures may not be the effect of education itself, but the effect of these unseen advantages.

We therefore use “geographical proximity to a college when growing up” as an exogenous instrument for education. Although it’s a useful strategy to select an effective instrument or instruments for each endogenous explanatory variable, in 2SLS regression all of the instrumental variables are used to estimate all of the regression coefficients in the model.

Q5: Estimate the effect of education on the log wage using instrumental variables. Compare the results from this exercise to those from question 2.

library(AER)
Warning: package 'AER' was built under R version 4.3.3
Loading required package: car
Warning: package 'car' was built under R version 4.3.3
Loading required package: carData
Warning: package 'carData' was built under R version 4.3.3

Attaching package: 'car'
The following object is masked from 'package:dplyr':

    recode
The following object is masked from 'package:purrr':

    some
Loading required package: lmtest
Warning: package 'lmtest' was built under R version 4.3.3
Loading required package: zoo
Warning: package 'zoo' was built under R version 4.3.3

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
Loading required package: sandwich
Warning: package 'sandwich' was built under R version 4.3.3
Loading required package: survival
Warning: package 'survival' was built under R version 4.3.3
# IV estimation: using nearc4 as an instrument for educ
# Other covariates (exper, expersq, black, south, smsa) are assumed to be exogenous and are included on both sides of the formula

iv_model <- ivreg(lwage ~ educ + exper + expersq + black + south + smsa | nearc4 + exper + expersq + black + south + smsa, data = nls_clean)
summary(iv_model)

Call:
ivreg(formula = lwage ~ educ + exper + expersq + black + south + 
    smsa | nearc4 + exper + expersq + black + south + smsa, data = nls_clean)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.82125 -0.24065  0.02368  0.25469  1.43205 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  3.7527813  0.8293409   4.525 6.27e-06 ***
educ         0.1322888  0.0492332   2.687  0.00725 ** 
exper        0.1074980  0.0213006   5.047 4.76e-07 ***
expersq     -0.0022841  0.0003341  -6.836 9.84e-12 ***
blackBlack  -0.1308019  0.0528723  -2.474  0.01342 *  
southSouth  -0.1049005  0.0230731  -4.546 5.67e-06 ***
smsaUrban    0.1313237  0.0301298   4.359 1.35e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.391 on 3003 degrees of freedom
Multiple R-Squared: 0.2252, Adjusted R-squared: 0.2237 
Wald test: 120.8 on 6 and 3003 DF,  p-value: < 2.2e-16 
modsum <- summary(iv_model, diagnostics = TRUE)

In this model, proximity to a 4-year college (nearc4) was used as an instrument for education, under the assumption that it affects wages only through its influence on educational attainment. The IV estimation shows that each additional year of education increases log wages by approximately 0.132, or about 13.2%, which is substantially higher than the estimate from the adjusted OLS model (7.4% per year). This suggests that the OLS model may underestimate the true causal return to education due to unobserved confounding factors like ability or family background. The IV model also confirms that wage outcomes are shaped by geography and race: being Black is associated with a 12% wage penalty, living in the South corresponds to an 11% reduction, and residing in an urban area is linked to a 13% wage premium. Interestingly, the squared experience term is positively associated with wages here, possibly reflecting model differences due to instrument usage. Overall, the IV results support the idea that accounting for endogeneity reveals a stronger causal effect of education on earnings than initially observed with OLS.

Q6: Use 2-stage least squares to estimate the effect of education on log wage doing each stage separately. What is the F-statistic from the 1st stage? How do your results from the 2nd stage compare to those from question 5?

# First-Stage Regression:
# Regress years of education on the instrument (nearc4) and control variables.

first_stage <- lm(educ ~ nearc4 + exper + expersq + black + south + smsa, data = nls_clean)
summary(first_stage)

Call:
lm(formula = educ ~ nearc4 + exper + expersq + black + south + 
    smsa, data = nls_clean)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.6419 -1.3928 -0.0953  1.2638  6.2692 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) 16.6591746  0.1763889  94.446  < 2e-16 ***
nearc4Yes    0.3373208  0.0825004   4.089 4.45e-05 ***
exper       -0.4100081  0.0336939 -12.169  < 2e-16 ***
expersq      0.0007323  0.0016499   0.444 0.657201    
blackBlack  -1.0061383  0.0896454 -11.224  < 2e-16 ***
southSouth  -0.2914640  0.0792247  -3.679 0.000238 ***
smsaUrban    0.4038769  0.0848872   4.758 2.05e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.943 on 3003 degrees of freedom
Multiple R-squared:  0.4745,    Adjusted R-squared:  0.4734 
F-statistic: 451.9 on 6 and 3003 DF,  p-value: < 2.2e-16
# Generate predicted values of education from the first-stage regression.
# These fitted values (educ_hat) represent the variation in education explained by the instrument (nearc4) and controls.
# We'll use educ_hat as a proxy for actual education in the second-stage regression to estimate the causal effect on log wages.

nls_clean$educ_hat <- predict(first_stage)
# Second-stage regression of 2SLS:
# Regress log wages (lwage) on the predicted education values (educ_hat) from the first stage,
# along with experience, experience squared, race, region, and urbanicity as control variables.
# This estimates the causal effect of education on wages, correcting for endogeneity using nearc4 as an instrument.

second_stage <- lm(lwage ~ educ_hat + exper + expersq + black + south + smsa, data = nls_clean)
summary(second_stage)

Call:
lm(formula = lwage ~ educ_hat + exper + expersq + black + south + 
    smsa, data = nls_clean)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.56525 -0.24771  0.01465  0.27091  1.38743 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  3.7527813  0.8495104   4.418 1.03e-05 ***
educ_hat     0.1322888  0.0504306   2.623  0.00876 ** 
exper        0.1074980  0.0218186   4.927 8.81e-07 ***
expersq     -0.0022841  0.0003423  -6.674 2.96e-11 ***
blackBlack  -0.1308019  0.0541582  -2.415  0.01579 *  
southSouth  -0.1049005  0.0236342  -4.438 9.39e-06 ***
smsaUrban    0.1313237  0.0308626   4.255 2.15e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.4005 on 3003 degrees of freedom
Multiple R-squared:  0.1871,    Adjusted R-squared:  0.1854 
F-statistic: 115.2 on 6 and 3003 DF,  p-value: < 2.2e-16

We found that a one-unit increase in the predicted years of schooling is associated with a 13.2% increase in log wages (coefficient = 0.132)

compares the coefficients and diagnostics (e.g., R², AIC, BIC) of the adjusted OLS model and the IV model side-by-side, making it easy to interpret differences in estimated effects of education when accounting for potential endogeneity.

library(modelsummary)
Warning: package 'modelsummary' was built under R version 4.3.3
m_list <- list(
  "OLS (Adjusted)"   = model2,
  "IV (2SLS)"         = iv_model
)
msummary(m_list)
OLS (Adjusted) IV (2SLS)
(Intercept) 4.734 3.753
(0.068) (0.829)
educ 0.074 0.132
(0.004) (0.049)
exper 0.084 0.107
(0.007) (0.021)
expersq -0.002 -0.002
(0.000) (0.000)
blackBlack -0.190 -0.131
(0.018) (0.053)
southSouth -0.125 -0.105
(0.015) (0.023)
smsaUrban 0.161 0.131
(0.016) (0.030)
Num.Obs. 3010 3010
R2 0.291 0.225
R2 Adj. 0.289 0.224
AIC 2633.4 2898.4
BIC 2681.5 2946.5
Log.Lik. -1308.702
F 204.932
RMSE 0.37 0.39

#The change in coefficients and associated standard errors can also be brought out graphically using the modelplot() function from modelsummary which shows the coefficient estimates along with their 95% confidence intervals.

library(modelsummary)

# Create the model list
m_list <- list(
  "OLS (Adjusted)" = model2,
  "IV (2SLS)" = iv_model
)

# Plot excluding intercept and experience terms
modelplot(m_list, coef_omit = "Intercept|experience")

—- End of Analysis —-