R Program Coding Problem Set 3 PDF

Title R Program Coding Problem Set 3
Author Dominick Cristiano
Course Introduction to Econometrics (P, T)
Institution New York University
Pages 3
File Size 82.8 KB
File Type PDF
Total Views 126

Summary

R Program Coding Problem Set 3
Traiberman Fall 2019...


Description

Undergraduate Econometrics: Problem Set 6 Due: December 13th at 5:00 pm Reminder: ⋆⋆ means optional

1. Guns and Crime Some U.S. states have enacted laws that allow citizens to carry concealed weapons. These laws are known as “shall-issue” laws because they instruct local authorities to issue a concealed weapons permit to all applicants who are citizens, mentally competent, and have not been convicted of a felony (some states have some additional restrictions). In “may issue” states, such as New York, applicants must demonstrate a reason for carrying a concealed weapon (dangerous line of work, history of threats, etc.). Proponents argue that, if more people carry concealed weapons, crime will decline because criminals are deterred. Opponents argue that crime will increase because of accidental or spontaneous use of the weapon. In this exercise, you will analyze the effect of concealed weapons laws on three different categories of crimes: violent crimes; robberies (such as the robbery of a convenience store); and murder (many of which are spontaneous acts of passion). In order to access the data we will use the AER package. In order to access the data we will need to install the package first (this only needs to be done once). Once installed the data() and ? commands can access and describe the dataset. The commands below summarize how to do this: 1

# Installs the p acka ge ( run o nc e )

2

install . packages ( " AER " )

3 4

# Loads the dataset from the package

5

data ( " Gu ns " , package = " AER " )

6 7

# Provides a detailed desc ription of the data

8

? Guns

Before continuing as a reminder of how to run a panel regression, we use the plm command with the appropriately defined index variables and model. The generic command will be: 9 10

# Running a panel regr ession in R plm ( y ~ x1 + x2 + ... , index = c ( " entityVariable " ," timeVariable ") , method = " method " , effect = " ind ividual ")

The “...”, entity and time variables, method and effect are left to you to fill in correctly. As a series of hints: within is the method that does fixed effects while fd takes first differences; individual does just individual effects, time does just time fixed effects, and twoway does both. (a) Please run the series of regressions below. In each, report the coefficient on law, the standard 1

error on law, the t statistic, and the F test of all variables except the fixed effects. It may be helpful to construct the table below:

Coefficient on law SE on law t stat on law Regression F Controls State FE Year FE Clustered SEs

(1)

(2)

(3)

(4)

(5)

No No No No

Yes No No No

Yes Yes No No

Yes Yes Yes Yes Yes Yes No Yes

In order to get the robust standard errors and the F -test on all the coefficients we will use the summary command, but informing it that we wish to use correct standard errors. Here is some sample code (as usual, fill in the dots): 11

# Recovering HETEROSCEDASTIC - ROBUST standard errors

12

m1 = plm ( y~x ,...)

13

summary ( m1 , vcov = vcovH C (m1 , type = " HC1 " , method =" white1 "))

14 15

# Recovering CLUSTER - ROBUST standard errors

16

m2 = plm ( y~x ,...)

17

summary ( m2 , vcov = vcovH C (m2 , type = " HC1 " , cluster =" group "))

1. A linear regression of log murder rate on whether a state has a shall-issue law. Notice that the crime rates are reported in levels, not in logs. You will need to apply the appropriate transformation. Hint: You can apply the logarithm directly in a regression. E.g., 18

# Logs directly in R

19

lm ( log ( y ) ~ x1 ,...)

2. Now include the following variables as controls: the percent of the state that is male male, the percent of the state that is African-American afam, the percent of the state that is Caucasian cauc, the log of income income, the log of density density, and the log of the prison population prisoners. Notice that once again, you will need to transform the variables that are not in logarithms. 3. Now run the same regression as in (ii) but adding state fixed effects. This requires using the individual method. 4. Now run the same regression as in (iii) but adding time fixed effects. This requires using the twoways method. 2

5. Finally, run the same regression as in (iv), but report the cluster robust standard errors. (b) For all of the regressions above: i. Write out the underlying statistical model being estimated. ii. Interpret the coefficient on law and comment on its economic significance (i.e., it is a “big” number, regardless of statistical significance). iii. Perform a 5% significance test of the variable law (c) Think of at least one omitted variable that is solved by the inclusion of state fixed effects. For your answer to be valid three conditions will have to be met: (1) the variable must be correlated with the probability of passing “shall-carry laws”; (2) the variable must be correlated with the murder rate; (3) the variable must be state-specific, but time-invariant. In addition to explaining why it meets conditions (1)-(3), describe the direction of the bias that results from ignoring it. (d) Think of at least one omitted variable that is solved by the inclusion of time fixed effects. A similar set of three conditions to above will have to be met, properly modified for time fixed effects. Also, describe the direction of the bias that results from ignoring your variable. (e) Think of a variable that is not included in this regression and is also not solved by including state level or time fixed effects. In what direction will this variable bias the regression? (f) Think of a variable inside of U that is autocorrelated (but not constant), important for determining crime rates, and is plausibly uncorrelated with X. The presence of such variables are why we cluster standard errors. Comparing specifications (iv) and (v), how much does controlling for autocorrelation in U matter for standard errors? (g) ⋆⋆ How would you include state-specific trends in these regressions? Two hints: (1) Adding a common trend line is easy—it means including time as a regressor; (2) To add state-specific trends, you will need some interaction terms.

3...


Similar Free PDFs