Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

14.

382 Pset 5
Parker Whitfill
March 2024

1 Problem 1
a.
Following the notation from class, let

Z
Fj|k (y) ≡ FYj |Xj (y|x)dFXk (x), y ∈ T,

where Y is log wage and X are the covariates. Then we can define exactly as in the notes

F(m|m) − F(w|w) = (F(m|m) − F(m|w) ) + (F(m|w) − F(w|w) )


| {z } | {z }
composition effect discrimination effect

b.
No, because there may be ’omitted variables’ that are correlated with being a man or woman
that determine the distribution of wages. For example, perhaps being a man or woman is correlated
with working more hours, then in a traditional labor market sense there is no discrimination in that
gender being paid more in overall wages. However, this decomposition would load this into the
’discrimination effect’ since we do not have an X variable for hours worked.

1
c.

Observed and Counterfactual Distributions (90% CI)


1.0

Observed women distribution


Observed men distribution
Counterfactual distribution
0.8
0.6
Probability

0.4
0.2
0.0

2.0 2.5 3.0 3.5 4.0 4.5

Log of hourly wage

Figure 1: Observed and Counterfactual Distributions (90% CI)

2
Observed and Counterfactual Quantiles (90% CI)
4.5

Observed women quantiles


Observed men quantiles
Counterfactual quantiles
4.0
Log of hourly wage

3.5
3.0
2.5
2.0

0.2 0.4 0.6 0.8

Quantile index

Figure 2: Observed and Counterfactual Quantiles (90% CI)

3
Gender wage gap (90% CI)

0.5
Quantile difference

0.3
0.1
−0.1

0.2 0.4 0.6 0.8

Probability

Discrimination (90% CI)


0.5
Quantile difference

0.3
0.1
−0.1

0.2 0.4 0.6 0.8

Probability

Composition (90% CI)


0.5
Quantile difference

0.3
0.1
−0.1

0.2 0.4 0.6 0.8

Probability

Figure 3: Gender Wage Gap Decomposition (90% CI)

4
Women log hourly wages Men log hourly wages

1500
800
600

1000
Frequency

Frequency
400

500
200
0

1 2 3 4 5 6 1 2 3 4 5 6

Log of hourly wage Log of hourly wage

Figure 4: Women vs Men Log Hourly Wages


2 Problem 2
a.
Here is a sufficient condition. Suppose that for all i, t

Yit (Di1 , Di2 . . . dit , . . . DiT ) = g(dit )

In words, the potential outcomes depend only on this periods treatment, not any other periods.
Formally, we are assuming that Dij for j < t is independent of the potential outcomes.
Then we can write

Yit = g(0) + [g(1) − g(0)]Dit


Yit = E[g(0)] + E[g(1) − g(0)]Dit + ϵit

where ϵit ≡ g(0) − E[g(0)] + [g(1) − g(0) − E[g(1) + g(0)])]Dit


We can verify strict exogeneity holds for all j < t
   
E[Dij ϵit ] = E[Dij g(0) − E[g(0)] ] + E[Dij Dit g(1) − g(0) − E[g(1) + g(0)] ]
= E[Dij ] E[g(0) − E[g(0)]] + E[Dit Dij ] E[g(1) − g(0) − E[g(1) + g(0)]]
=0

where the second line holds because g(0), g(1) do not depend on Dij for j < t by the assumption I
made, and we have independence for Dit by random assignment.

b.
We can use the fixed effect estimator since we proved in class that strict exogenity is a sufficient
condition to estimate α via fixed effects.

c.
Define estimator β̂
T
1X
β̂ ≡ E[Yit |Dit = 1] − E[Yit |Dit = 0]
T t=1
T
1X
= E[Yit (Di1 , Di2 , . . . Dit . . . DiT )|Dit = 1] − E[Yit (Di1 , Di2 , . . . Dit . . . DiT )|Dit = 1]
T t=1
T
1X
= E[Yit (Di1 , Di2 , . . . 1 . . . DiT )] − E[Yit (Di1 , Di2 , . . . 0 . . . DiT )] By random assignment
T t=1

6
d.
Suppose Yit (d1 , . . . dt , . . . dT ) = g(dt−1 , dt ) so it depends on the last treatment periods. Then

Yit = g(Di(t−1) , 0) + [g(Di(t−1) , 1) − g(Di(t−1) , 0)]Dit


E[g(Di(t−1) , 0)] + E[g(Di(t−1) , 1) − g(Di(t−1) , 0)]Dit + ϵit
 
where ϵit = g(Di(t−1) , 0)−E[g(Di(t−1) , 0)]+ g(Di(t−1) , 1)−g(Di(t−1) , 0)−E[g(Di(t−1) , 1)−g(Di(t−1) , 0)] Dit .
Strict exogeneity requires that E[Dij ϵit ] for all j ≤ t. But notice that in this case for j = t−1 then
this is not necessarily true because ϵit explicitly depends on Dit−1 so we may not have orthogonality.

e.
No, this is immediate from part d since we produced an example where random assignment
holds but strict exogeneity does not hold. Moreover, we saw from class that with fixed effects we
have a full charectorization of what is needed to estimate the causal effect. We need

f.
Expanding we have

Yit = αi (1 + p + p2 . . . pt ) + α(Dit + Di,t−1 p + Di,t−2 p2 . . . Di,1 pt ) + (ϵit + ϵi,t−1 p + ϵi,t−2 p2 . . . ϵi,1 pt )

Now it is no longer possible that Yit (d) = g(dt ) since the other treatment periods explicitly
appear in the equation for the outcome. However, we could proceed similarly as before, assuming
Dit is randomly assigned in each period - however we add the additional assumption that Dij
independent of Yit (d) for Dij where j < t. This is not guaranteed by Dij random assignment
but is an assumption that the potential outcomes in a period do not depend on treatment in
previous periods. This also makes sure the pre determined regressor from the textbook holds since
Yit−1 (Di,t−1 , Di,t−2 . . . ) ⊥ ϵit is implied by the fact that there is no serial correlation in ϵ and
that Di,j for j < t is independent of Yit (d) and thus ϵit . Finally, we can verify α measures the
average contemporaneous effect by repeating the exact same logic as part a with the minor twist
that instead of the potential outcomes only depending on Di t even in a stochastic sense, we have
the potential outcomes only depend on Di t from a mean sense by the independence assumption we
are making.

g.
We are letting previous treatment periods have an a causal effect on the current potential
outcome and thus treatment effects, which is why need to make some sort of restriction where
previous treatment do not change the selection into treatment in the current treatment.

7
## 14.382 PS5 Q1, Parker Whitfill worked with Kao, Yucheng, Ryo

# This empirical example uses the data from the CPS to illustrate the use of distribution regression and counterfactual
distributions
# in the estimation of the gender gap

# Based on code by V. Chernozhukov and I. Fernandez-Val

# Data source: IPUMS-CPS through Paul Schrimpf


# URL for data: https://cps.ipums.org/cps/

# Description of the data: the sample selection and variable contruction follow

# Mulligan, Casey B., and Yona Rubinstein. "Selection, investment, and women's relative wages over time." The Quarterly Journal
of Economics (2008): 1061-1110.

# Sample selection: white non-hipanic, ages 25-54, working full time full year (35+ hours per week at least 50 weeks), exclude
living in group quarters,
# self-employed, military, agricultural, and private household sector, allocated earning, inconsistent report on earnings and
employment, missing data

# The variables used in the analysis include:

# - lnw: log of hourly wage (annual earnings / annual hours)


# - female: female indicator
# - 6 married status indicators: widowed, divorced, separated, nevermarried, and married (omitted)
# - 6 education attainment indicators: hsd08, hsd911, hsg, cg, ad, and sc (omitted)
# - 4 region indicators: mw, so, we, and ne (omitted)
# - Quartic in potential experience (max[0, age - years of education - 7]): exp1, exp2 (divided by 100), exp3 (divided by 1000),
exp4 (divided by 10000)
# - weight: March Supplement sampling weight
# - year: CPS year

# We use the package discreteQ available at https://github.com/bmelly/discreteQ

############

# Part I: Installation of discreteQ package for counterfactual analysis

#install.packages("devtools")
#devtools::install_github("bmelly/discreteQ")

####################

# Part II: set up the data

rm(list = ls());

filepathPW<-"/Users/parkerwhitfill/Dropbox/School_Work/PhD/Year 1/Spring/14.382/Pset5/Data and code for Pset 5"


setwd(filepathPW)

options(warn=-1); # sets warnings off;


load('cps2015.rdata');
attach(data);
library(discreteQ);
library(xtable);

# Descriptive statistics,

vars <-
c("lnw","female","married","widowed","separated","divorced","nevermarried","lhs","hsg","sc","cg","ad","ne","mw","so","we","exp1");

options(digits=2);
dstats <- cbind(sapply(data[,vars], weighted.mean, weight), apply(data[female==1,vars], 2, weighted.mean, weight[female==1]),
apply(data[female==0,vars], 2, weighted.mean, weight[female==0]));

xtable(dstats);

# Part III: Set parameters for estimation and run estimation


nind <- 39; # Number of distribution regressions to estimate conditional and counterfactual distribution;
taus <- c(3:(nind-2))/(nind+1); #quantile indexes of interest
alpha <- 0.10; #significance level for confidence bands
form <- lnw ~ widowed + divorced + separated + nevermarried +(lhs+hsg+cg+ad)*(exp1+exp2+exp3+exp4) + mw + so + we;
reg <- model.matrix(form, data=data); #matrix of regressors for DR
ys <- quantile(lnw, c(.02,c(1:nind)/(nind+1), .98)); #thresholds for DR estimation
R <- 200; #number of bootstrap repetitions
my_cl <- parallel::makePSOCKcluster(24, setup_timeout = 0.5); # number of proccessors for parallel computing
set.seed(1);

# Estimation;
dr.fit <- discreteQ(y = lnw,d = 1-female,x = reg, w = weight, decomposition = TRUE, q.range=range(taus), method="logit",
bsrep=R, alpha=alpha, ys=ys, cl= my_cl)
# Hints:
#Define the treatment (d) as male to obtain positive values for the gender gap, d=1-female
#The r command "DiscreteQ" will give you everything you want here in one step. Note that you want w=weight,
#decomposition = TRUE, q.range=range(taus), method="logit", bsrep=R, alpha=alpha, ys=ys, cl= my_cl
# Part IV: Make figures based on results

pdf("Gender-gap-hists.pdf", pointsize=15, paper = "a4", width=8.0,height=8.0);


par(mfrow=c(1,2));
hist(lnw[female==1], breaks = unique(lnw[female==1]), col=2, xlab="Log of hourly wage", lwd=2,
ylab="Frequency",
main="Women log hourly wages",
sub=" ");
hist(lnw[female==0], breaks = unique(lnw[female==0]), col=2, xlab="Log of hourly wage", lwd=2,
ylab="Frequency",
main="Men log hourly wages",
sub=" ");
dev.off();

pdf("Gender-gap-dist2-sb.pdf", pointsize=15, paper = "a4", width=8.0,height=8.0);


par(mfrow=c(1,1));

plot(range(ys), c(0,1), type="n",col=1, xlab="Log of hourly wage", lwd=2,


ylab="Probability",
main="Observed and Counterfactual Distributions (90% CI) ",
sub=" ");
polygon(c(ys,rev(ys)),c(dr.fit$ub.F0(ys),rev(dr.fit$lb.F0(ys))), density=100, border=F,
col='light blue', lty = 1, lwd = 1);
lines(ys, dr.fit$F1(ys), lwd=1, col = 4 );

polygon(c(ys,rev(ys)),c(dr.fit$ub.Fc(ys),rev(dr.fit$lb.Fc(ys))), density=100, border=F,


col='light grey', lty = 1, lwd = 1);
lines(ys, dr.fit$Fc(ys), lwd=1, col = 'dark grey' );

polygon(c(ys,rev(ys)),c(dr.fit$ub.F1(ys),rev(dr.fit$lb.F1(ys))), density=100, border=F,


col='light green', lty = 1, lwd = 1);
lines(ys, dr.fit$F0(ys), lwd=1, col = 'dark green' );

legend(quantile(ys, .01), 1, c(' ', ' ',' ' ), col = c('light blue','light green','light grey'), lwd = c(4,4,4), horiz = F, bty =
'n');
legend(quantile(ys, .01), 1, c('Observed women distribution','Observed men distribution', 'Counterfactual distribution'), col =
c(4,'dark green', 'dark grey'), lwd = c(1,1,1), horiz = F, bty = 'n');

dev.off();

pdf("Gender-gap-quant2-sb.pdf", pointsize=15, paper = "a4", width=8.0,height=8.0);

par(mfrow=c(1,1));

plot(range(taus), range(ys), type="n",col=1, xlab="Quantile index", lwd=2,


ylab="Log of hourly wage",
main="Observed and Counterfactual Quantiles (90% CI) ",
sub=" ");

polygon(c(taus,rev(taus)),c(dr.fit$ub.Q0(taus),rev(dr.fit$lb.Q0(taus))), density=100, border=F,


col='light blue', lty = 1, lwd = 1);
lines(taus, dr.fit$Q0(taus), lwd=1, col = 4 );

polygon(c(taus,rev(taus)),c(dr.fit$ub.Qc(taus),rev(dr.fit$lb.Qc(taus))), density=100, border=F,


col='light grey', lty = 1, lwd = 1);
lines(taus, dr.fit$Qc(taus), lwd=1, col = 'dark grey' );

polygon(c(taus,rev(taus)),c(dr.fit$ub.Q1(taus),rev(dr.fit$lb.Q1(taus))), density=100, border=F,


col='light green', lty = 1, lwd = 1);
lines(taus, dr.fit$Q1(taus), lwd=1, col = 'dark green' );

legend(min(taus), max(ys), c(' ', ' ',' '), col = c('light blue','light green','light grey'), lwd = c(4,4,4), horiz = F, bty =
'n');
legend(min(taus), max(ys), c('Observed women quantiles', 'Observed men quantiles', 'Counterfactual quantiles'), col = c(4,'dark
green','dark grey'), lwd = c(1,1,1), horiz = F, bty = 'n');

dev.off();

pdf("Gender-gap-qte-decomposition-sb.pdf", pointsize=15, paper = "a4", width=5,height=10.0);

par(mfrow=c(3,1));

plot(dr.fit, which="observed", support="continuous",main="Gender wage gap (90% CI)", ylim = c(-.15,.5));


abline(h=0, col ="light grey")
plot(dr.fit, which="unexplained", support="continuous",main="Discrimination (90% CI)", ylim = c(-.15,.5));
abline(h=0, col ="light grey")
plot(dr.fit, which="composition", support="continuous",main="Composition (90% CI)", ylim = c(-.15,.5));
abline(h=0, col ="light grey")

dev.off();

You might also like