<jupyter_start><jupyter_text>EEP/IAS 118 - Problem Set 5 Due __Friday, December 4__ at 11:59PM. Submit materials as one combined pdf on __Gradescope__. All work can be completed in this notebook. Make sure to run (`shift` + `enter`) all your answer cells before submission to make sure all your output is displayed.  Exercise 1. The Effect of Minimum Wage on Employment - Difference-in-Differences BackgroundIn this exercise, we are going to look at a classic paper in the labor economics literature (note that we are only giving you a subset of the data, so your results are not going to match the results in the paper). This paper answers a very important (and often controversial!) question in economic policy: does increasing the minimum wage increase unemployment (or conversely, reduce employment)? Proponents of minimum wage laws point to the benefits for individuals who remain employed in low wage jobs. Opponents of minimum wage laws argue that the increases in labor costs result in higher unemployment because employers hire less employees to offset the cost increases. <NAME> (1994) test this latter hypothesis using the minimum wage increase in New Jersey that went into effect in 1992. They surveyed fast food establishments in New Jersey and Pennsylvania both before and after the policy came into effect, collecting information on wages, employment and prices. While the interviews all occurred in 1992, the post-period interviews are coded as 1993 in your data for the sake of simplicity. This data is then used to obtain a difference-in-differences estimate of the effect of minimum wage laws on employment. The dataset is saved as `minwage_data.csv` and contains the following variables:    |    Variable Name     | Description                       | |----------------------|-----------------------------------|| $store\_id $      | Unique Store ID      || $year    $ | Year    || $state   $  | Dummy =1 if store is located in New Jersey, =0 for Pennsylvania     || $shore  $  | Dummy =1 if store is located on New Jersey Shore, =0 otherwise    || $empft   $   | Number of full-time employees in a store    || $emppt  $    | Number of part-time employees in a store    || $nmgrs  $    | Number of managers in a store    || $wage\_st $     | Starting wage in a store    || $pentree $    | Price of an entree   || $fte  $    | Number of full-time equivalent employees in a store ($empft+0.5emppt+nmgrs$)   |  Question 1. Generate a summary table with two columns and two rows. There should be two columns:  one for New Jersey (Treatment column) and one for Pennsylvania (Control column) and two rows: one for the pre-period (year 1992), one for the post-period (years 1993). Within each cell, compute the mean number of full-time equivalent employees (the variable $fte$).<jupyter_code>#Input your code for Question 1 here.<jupyter_output><empty_output><jupyter_text>Add your written answer for Question 1 here  Question 2. State the difference-in-differences estimator for the change in full-time equivalent employees in terms of the following quantities $\bar Y_{NJ, pre}, \bar Y_{NJ, post}, \bar Y_{Penn, pre}, \bar Y_{Penn, post}$, where $\bar Y$ refers to the mean of $fte$. Using the means reported in part 1, calculate a value for the estimator you just proposed.<jupyter_code>#Input your code for Question 2 here<jupyter_output><empty_output><jupyter_text>Add your written answer for Question 2 here  Question 3. Let's proceed with estimating the difference-in-difference esstimation via a regression: (a)  Write an equation that will give you the difference-in-differences estimator for the impact of the minimum wage increase on full time equivalent employees. Add your written answer for Question 3a here  (b)  Give the __economic__ interpretation for each of the coefficients you wrote in part (a) Add your written answer for Question 3b here  (c) Perform the estimation.<jupyter_code># Input your code for Question 3c here<jupyter_output><empty_output><jupyter_text>(d) What do you conclude from the results of your estimation? Confirm that the results in this part are approximately the same as those in Question 2. Add your written answer for Question 3d here  Question 4. In this question, we will explore the identifying assumptions for the difference-in-differences estimator. (a) What key assumption do you need to make for your regression in part 3 to estimate the causal effect of minimum wage laws? Add your written answer for Question 4a here.   (b) What additional data might you need to provide evidence for this assumption? Add your written answer for Question 4b here.   Question 5. Let's say that we wanted to estimate the effect of minimum wage laws on full-time equivalent employment ($fte$), but we only had data from New Jersey. Using a simple difference in means, estimate and interpret the effect of minimum wage laws on full-time employment in New Jersey. Make sure to test for significance.<jupyter_code>#Input your code for Question 5 here<jupyter_output><empty_output><jupyter_text>Add your written answer for Question 5 here  Question 6.   In no more than 3 sentences, compare your conclusion in  Question 4 to your conclusion in Question 5. If you draw different conclusions from the results of Questions 4 and 5, what might explain this difference (i.e., why is one estimator preferable)? Add your written answer for Question 6 here  Exercise 2:  Schoolbus Replacements and Attendance - Panel Regression BackgroundIn this problem, we will look at the effect of replacing highly-polluting school buses on students' health. Many school districts in California, particularly less wealthy school districts, have school buses that are many decades old. These buses do not have many of the pollution controls that are now standard in vehicles, exposing the students that ride them to high concentrations of pollutants. In 2006, the state of California passed a proposition that allocated funds towards replacing the oldest of these school buses with new models that had adequate pollution controls. We have data for these replacements for the years 2009-2012, with the number of replacements per year more or less increasing over the sample period. This data is combined with attendance data from all school districts in California over the same period to test the impact of reducing pollution exposure through bus replacements on student health. Attendance is used to measure student health because students who are chronically ill are often absent from school. The full dataset is described in detail below. The dataset `Schoolbuses_PS5.dta` is an unbalanced panel of 209 school districts for the years 2009-2012, and contains the following variables:  |    Variable Name     | Description                       | |----------------------|-----------------------------------|| $district\_code $      | Unique School District Identifier    || $year    $ | Year    || $bus\_replace   $  | Number of Buses Replaced   || $attendance  $  | Percent of students in attendance   || $gifted  $   | Numberof students in the Gifted Student Program  || $white $    | Number of White Students  || $college $    | Number of Students with Parents that Attended College   || $advtgd $     | Number of Students from Higher Socio-Economic Backgrounds    || $fleet\_size $    | Number of Buses in the District Fleet   || $pupils\_trans  $    | Average Number of Students Traveling per Day   || $enrollment$     | Number of Students Enrolled in the District  Some summary statistics are provided below<jupyter_code>schooldata <- read_dta("Schoolbuses_PS5.dta")
head(schooldata)

# Summary Stats
busrep <- summarize(schooldata, mean = mean(bus_replace),
             sd= sd(bus_replace),
             min= min(bus_replace),
             max = max(bus_replace))

enroll <- summarize(schooldata, mean = mean(enrollment),
             sd = sd(enrollment),
             min = min(enrollment),
             max = max(enrollment))
fleet <- summarize(schooldata, mean = mean(fleet_size, na.rm = TRUE),
             sd = sd(fleet_size, na.rm = TRUE),
             min = min(fleet_size, na.rm = TRUE),
             max = max(fleet_size, na.rm = TRUE))

ss <- rbind(busrep, enroll, fleet)
sumstats <- cbind(c("Bus Replacements", "Enrollment", "Fleet Size"), ss)
names(sumstats)[1] <- "Variable"

print('Sum Stats')
sumstats<jupyter_output><empty_output><jupyter_text>Question 1. You think that it might be important to control for the year in your regression of attendance on bus replacements.  First, generate year dummy variables $(yr_{2009}, yr_{2010}, yr_{2011}, yr_{2012})$.  Next, estimate the following equation for school attendance.\begin{align*}attendance_{it} = \beta_0+ \beta_1 bus\_replace_{it} + \beta_2white_{it} &+ \beta_3college_{it} + \beta_4advtgd_{it} + \beta_5gifted_{it} \ \ \ \ \ \ (1) \\&+ \delta_1yr_{2010} + \delta_2yr_{2011} + \delta_3yr_{2012} + u_{it}    \end{align*} (a) Estimate the model and report your results.<jupyter_code>#Input your code for Question 1 here<jupyter_output><empty_output><jupyter_text>Add any written answer for Question 1a here  (b) Give the meaning (economic interpretation) of $\beta_0$ and $\delta_{1}$ Add your written answer for Question 1b here  (c) Interpret (SSS) your estimate for $\beta_1$.  Add your written answer for Question 1c here  (d) Why is the year 2009 dummy excluded? Add your written answer for Question 1d here  Question 2. Consider now the following (unobserved) fixed effects model:\begin{align*}attendance_{it} =\beta_0+ \beta_1 bus\_replace_{it} + \beta_2white_{it} + \beta_3college_{it} + \beta_4advtgd_{it}+ \beta_5gifted_{it} + \boldsymbol{\delta}_t+\mathbf{a_i} +u_{it} \ \ \ (2)\end{align*} (a) What is the interpretation of the vector of fixed effects terms $\mathbf{a_{i}}$? Add your written answer for Question 2a here  (b) Why are we adding these fixed effects, as opposed to estimating model (2)? In other words, what do these fixed effects control for in the regression?  Add your written answer for Question 2b here  (c) Estimate the model and  interpret $\hat \beta_1$ (remember SSS)<jupyter_code># Input your code for Question 2c here<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07964254149071982, 'fraction_numerical': 0.015516056172051458, 'mean_word_length': 3.946090335114133, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '453170', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2748, 'n_tokens_neox': 2549, 'n_words': 1337, 'path': 'Assignments/Assignment 5/PS5.ipynb', 'repo_name': 'ds-modules/ENVECON-118-FA20', 'size': '10193'}