ECON 599 Problem Set 3

Due: April 27, 2018

NOTE: For this problem set please make sure to hand in your own individual copy.

1 Lalonde NSW Data

A. Load the Lalonde experimental dataset with the lalonde data method from the mod-

ule causalinference.utils. The outcome variable is earnings in 1978, and the co-

variates are, in order:

Black Indicator variable; 1 if Black, 0 otherwise.

Hispanic Indicator variable; 1 if Hispanic, 0 otherwise.

Age Age in years.

Married Marital status; 1 if married, 0 otherwise.

Nodegree Indicator variable; 1 if no degree, 0 otherwise.

Education Years of education.

E74 Earnings in 1974.

U74 Unemployment status in 1974; 1 if unemployed, 0 otherwise.

E75 Earnings in 1975.

U75 Unemployment status in 1975; 1 if unemployed, 0 otherwise. Using CausalModel from the module causalinference, provide summary statistics

for the outcome variable and the covariates. Which covariate has the largest normalized


B. Estimate the propensity score using the selection algorithm est propensity s. In se-

lecting the basic covariates set, specify E74, U74, E75, and U75. What are the additional

linear terms and second-order terms that were selected by the algorithm?

C. Trim the sample using trim s to get rid of observations with extreme propensity score




values. What is the cut-off that is selected? How many observations are dropped as a


D. Stratify the sample using stratify s. How many propensity bins are created? Report

the summary statistics for each bin.

E. Estimate the average treatment effect using OLS, blocking, and matching. For match-

ing, set the number of matches to 2 and adjust for bias. How much do the estimates


2 Document Classification

A. From the module sklearn.datasets, load the training data set using the method

fetch 20newsgroups. This dataset comprises around 18000 newsgroups posts on 20

topics. Print out a couple sample posts and list out all the topic names.

B. Convert the posts (blobs of texts) into bag-of-word vectors. What is the dimensionality

of these vectors? That is, what is the number of words that have appeared in this data


C. Use your favorite dimensionality reduction technique to compress these vectors into

ones of K = 30 dimensions.

D. Use your favorite supervised learning model to train a model that tries to predict the

topic of a post from the vectorized representation of the post you obtained in the

previous step.

E. Use the test data to tune your model. Make sure to include K as a hyperparameter as

well. Use accuracy score from sklearn.metrics as your evaluation metric. What is

the highest accuracy you are able to achieve?