Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

APEC 3003, Spring 2023

Homework 4

Following a simulation

Here is some R code that can be found attached to this assignment (assignment4Q2.r).

N <- 100000

set.seed(3262019)         # So that everybody gets the same answer.

x <- runif(N)            # random numbers between 0 and 1

x1 <- as.numeric(x > 0.7) # dummy

x2 <- x*rchisq(N, 3)      # another fake regressor correlated with x1

FakeData <- data.frame(x1=x1, x2=x2)

B <- 100

goodbeta2 <- rep(NA, B)

badbeta2 <- rep(NA, B)

bad.tstat2 <- rep(NA, B)

for (b in 1:B) {

FakeData <- within(FakeData, {

y <- 7 + 3*x1 + 0*x2 + rnorm(N) # Fake regression model.

})

goodReg <- lm(y~x1+x2, data=FakeData)

goodbeta2[b] <- coef(goodReg)["x2"]

badReg <- lm(y~x2, data=FakeData)

badbeta2[b] <- coef(badReg)["x2"]

bad.tstat2[b] <- badbeta2[b]/sqrt(vcov(badReg)["x2","x2"])

}

There is a loop in this code.  The loop starts at line 11 with for (b in 1:B){, indicating that the loop runs for every line from 12 to 19 over all values between 1 and B as defined on line 7.

The other set of brackets are for a function. Line 13 generates fake y data for the regression model y = β0 + β1 X1 + β2 X2 + u where β 1  = 3 and β2  = 0 (why I picked β2  = 0 will become clear later).

The only thing that differs in line 13 from one time around the loop to the next is that there is a new u and therefore a new y . The denominator in line 19 is just a way of getting the standard error out of the saved regression.

Before going on to the questions below, spend some time to understand the rest of the code to be able to answer the questions effectively.

Question 1 (10 points)

What is bad about badReg?  (This is an econometrics question, not an R question.) What does that say about the different values in the vector badbeta2? By contrast, what about the values in goodbeta2?

Question 2 (10 points)

Add to the R script some code that calculates and prints the means of goodbeta2, badbeta2, and bad.tstat2. Report this code in your write up. 

Question 3 (10 points)

Before you run the code, write down what you expect from those means.

Question 4 (10 points)

What are the means of goodbeta2, badbeta2, and bad.tstat2?

Question 5 (10 points)

Now that you know how goodbeta2 and badbeta2 turned out on average, how do the answers tie in with your answer to Question 1?

Question 6 (10 points)

Since we made fake data, we know that β2  = 0. What does it tell you that the values of bad.ttest2 are all greater than 110?  (This is an extension of Qustions 1 and 5.)

Reading published econometrics

An interesting study by Brian Duncan, Hani Mansour, and Bryson Rintala estimates how the number of combat casualties of individuals from a U.S. county influences the likelihood that others from the county will enlist in the military.1   Military recruitment in the U.S. works like this.  After applying, a potential recruit goes through some screening. If the military decides it wants him/her, he/she signs a contract,” which is basically a promise to show up for basic training at some later date.  Some applicants enter the Delayed Entry Program (DEP), which allows them to delay entering the military for up to a year.  (These are mostly high-school students who can’t enter until they’ve graduated.)  Even though it is called a contract, a recruit who chooses to back out before starting basic training can do so.

The data used for this part of the study consist of monthly observations for counties from 1997 through 2012, a period that includes the wars in Afghanistan and Iraq.  The sample size is therefore approximately the number of months times number of counties. The regression model is as follows:

Enlistmentsct  = β0 + π1 CasualtiesBeforect + π2 Casualtiesct + π3 CasualtiesAfterct + 61 1{4% ≤ UR ≤ 6%}ct + 62 1{6% < UR}ct + φln(popct)    + µc + τt + θstatet + ect

Here Enlistmentsct  is the number of individuals from county c who signed a contract in month t and actually entered military service sometime later.

The  CasualtiesBeforect ,  Casualtiesct , and  CasualtiesAfterct  variables are, respectively, the number of casualties of individuals from county c in the six months before the contract was signed, during that month, and in the six months after.  CasualtiesAfterct  might affect the likelihood of people dropping out after entering the DEP, while the other two casualty terms are intended to reflect how casualties deter applications.

UR is the county unemployment rate. In the regressions, the unemployment rate is split into three dummy variables for the ranges: less than 4%, 4–6%, and over 6%. That’s what the bold number one 1 is - an indicator variable that county c in year t has an unemployment rate in the given range.  The reference category is an unemployment rate less than 4%.

popct  is county population. µc  are county xed effects - dummy variables for every county in the sample except for one. τt  are year xed effects - indicator variables that the year is equal to t for any given t. You can ignore the θstatet part.

Their results are on the last page.

Question 7 (10 points)

Give an interpretation of the −5.51 coefficient at the top of the  Army” column.  Here the columns represent for which branch of the military enlistments are measured. Basically, the y variable is Enlistmentsct(S)ervice  for the service listed at the top of the column.

Also note: the casualty variables are measured in tens. In other words, Casualtiesct  goes up by 1 if there are 10 more casualties in county c in month t. Also, the casualty variables refer to casualties across all services, not just the army.

Question 8 (10 points)

Give an interpretation of the 0.32 coefficient for unemployment rate 6.0+” (dummy variable) at the bottom of the “Army” column.  That dummy variable and the  “4.0 to 6.0” variable were created from the unemployment rate. Does the magnitude of this coefficient make sense relative to the coefficient for “4.0 to 6.0”? Why (not)?

Question 9 (10 points plus 5 bonus points)

Pretend you can’t see the absence of stars next to the 0.37 coefficient for  “6 months before contract” in the  Air Force” column. Show how to determine whether the estimated coefficient is statistically significant at the 1 percent level. Show the null hypothesis, the test statistic,  and explain your conclusion.

Extra credit: Find the p-value using the pnorm function in R. Copy your one line of R code and the result into your answer.

Question 10 (5 points)

The three  Casualties  coefficients in each column are not very different.   Maybe casualties have the same effect whenever they occur during this 12-month window. How would you test that what are the exact the null hypothesis and type of test would you use? What R function would you need to carry out the test?

Question 11 (5 points)

Explain what it means for an independent variable to be endogenous.  Give an argument for why the  Casualties variables can be considered exogenous (not endogenous).

Table 2: Effect of U.S. Combat Casualties from County on Number of New Enlistments from County, by Service

Casualties:

6 months before contract

All    Services

Army

Navy

Air Force

Marines

Coast

Guard

- 14.28*** (4.47)

-5.51*** (1.88)

-3.21*** (0.74)

-0.37

(0.45)

-4.88*** (1.51)

-0.31*** (0. 11)

Month contract signed

- 12.14*** (4. 18)

-3.55*** (1.21)

-3.13*** (0.83)

-0.19

(0.50)

-4.83*** (1.84)

-0.45*** (0. 11)

6 months after contract

- 11.31*** (3.55)

-2.77*** (1.06)

-2.30*** (0.49)

-0.72*

(0.43)

-5.15*** (1.59)

-0.37*** (0. 13)

ln(population)

4.19*** (0.54)

1.77*** (0.22)

0.87*** (0. 11)

0.70*** (0.09)

0.79*** (0. 19)

0.06*** (0.02)

Unemployment rate (base: <4.0):

 

 

 

 

 

 

4.0 to 6.0

0.45*** (0.05)

0.19*** (0.02)

0.07*** (0.01)

0.08*** (0.01)

0.11*** (0.02)

0.01*** (0.00)

6.0+

0.70*** (0.07)

0.32*** (0.03)

0.10*** (0.01)

0.11*** (0.01)

0.15*** (0.02)

0.02*** (0.001)

Sample Size

565,987

565,987

565,987

565,987

565,987

565,987

* Statistically significant at 10% level; **at 5% level; ***at 1% level.

Source: Defense Manpower Data Center (DMDC) from October 1, 1997 to October 31, 2012.

Notes:  Standard errors clustered county level are shown in parentheses.  The sample includes new enlistments with no prior  military service, with a U.S. home state, and who accessed into military service after they signed their enlistment contract.      Casualties is the number of U.S. combat casualties, measured in tens, from the same county as the applicant in the months      before, during, and after the enlistment contract was signed.  All regressions include controls county fixed effects, month date fixed effects, and state specific linear month date trends.