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

EC420:  Introduction to Econometric Methods - Spring 2023

Problem Set 1.  Due on Wednesday, February 1st, 2023, at the beginning of class.

Please show your work in detail.

Theory

This problem test is a series of questions related to the radon tests. For a house in Michigan (MI), n = 51 hourly radon measurements were taken in the winter of 2006. The sample average of those measurements is y = 1.68 and the sample variance is s2  = 0.851.  For another house in New York (NY), n = 44 hourly radon measurements were taken in the winter of 1999. The sample average of those measurements is y = 4.19 and the sample variance is s2 = 0.3098.

1. Assuming that radon levels in the NY basement follow a normal random variable with pop- ulation mean β0  = 4 and population variance σ 2  = 0.36, compute the probabilities of the following events for the house in NY:

(a)  The radon level goes below 1.

(b)  The radon level goes above 5.

(c)  The radon level is within 0.5 of the EPA cutoff of 4.

(d)  The radon level does NOT exceed the cutoff of 4.

(e)  The radon level is NOT within 0.5 of the EPA cutoff of 4.

2.  Suppose we have a data set with only two observations, y1  and y2 .  The general formula for

the sample average is

y = yi =  (y1 + y2 + y3 + ... + yn)

which simplifies to

2

y = yi =  (y1 + y2 )

i=1

when n = 2.

(a) Assuming that y1  and y2  are randomly sampled from a population with mean, β0 , and variance, σ 2 , derive a formula for the expectation of y . In other words, derive a formula

for E(y). Your answer should depend on β0 .

(b) Is y an unbiased estimator of β0 . Why or why not?

(c)  Compute the variance of y , i.e. compute var(y). Your answer should be a formula that depends on σ 2 .


(d)  Suppose y1  and y2  are sampled from the population in such a way so that they are correlated with each other. In particular, suppose cov(y1 ,y2 ) = γ  0. Does this change whether or not y is unbiased? Why or why not?

3.  Consider the null hypothesis that the population mean, β0 , of the radon in the Michigan house is equal to the EPA cutoff of 4.

(a) Write the null hypothesis as a mathematical statement about β0 . 

(b) Write the alternative hypothesis as a mathematical statement about β0 .

(c) When testing this null hypothesis, are you doing a left-tail, right-tail or two-tailed test? Why or why not?

(d) What estimator of β0  (not the number for the estimate itself) will you need to use to test the null hypothesis? What is the formula for the variance of this estimator?  (Don’t derive it, just write it down).  How can you estimate this variance formula?  How can you use the estimated variance to obtain a standard error for your estimator of β0 ?

4.  Test the null hypothesis from Question 3 using a t-test.   Assume you do  not  know the population distribution of radon.  You will have to rely on the central limit theorem and approximate the null distribution of your t-statistic using the N(0, 1) distribution.   Carry out your test at the 5% significance level (α = 0.05).  Clearly explain how you compute the t-statistic.  Clearly state the rejection rule you are using and how you obtained your critical value. What is the result of your test?

5.  Compute the non-rejection region  (the 95% confidence interval) for your test in question

4.  Interpret this non-rejection region.  Does is suggest my house is relatively safe, at least according to the EPA?

6. How would your calculations in Questions 4-5 have to be modified if you knew that radon is normally distributed in the population? You don’t have to actually redo the calculations, just point out the places where you would have to do things differently and explain why.

Applied

1.  Setup

A. Load libraries

Load the wooldridge library, along with knitr. Then, create an object called wage2 using the following code: wage2  =  wooldridge::wage2. No need to write an answer in text afterwards, just the code will do.


B. Show installed packages

Run the code installed .packages()[,c(1,3)].  Here, the function installed .packages() returns a matrix with a lot of information on what packages you have installed. We subset to just column 1 and 3, the name and version.

This might be quite long, especially if you’ve used R before.

That’s OK. No need to write an answer in text afterwards, just the code will do.

2.  Standard Error of the Means

We want to compare the average wage of high school graduates (12 years of education) with college graduates (16 years of education). To do that, we will calculate the mean and the standard error of the mean for each group.  In 3, we will calculate the standard error of the difference in means.

A. Subset wage2

You have already created wage2 back in 1A. We want to subset wage2 keeping only those rows where wage2$educ==12|wage2$educ==16 (12 or 16 years of education).  We are subsetting rows, so our subset index will be inside the square brackets before the comma.

Remember that when you  subset  a  data.frame,  you  must overwrite the old one:   wage2  = wage2[???,]

Question: How many rows does wage2 have once you have subset it? Use NROW to see.

B. Create a college logical

In a new code chunk labeled 2B, add a new variable (column) to wage2 that is equal to TRUE when educ==16 and FALSE otherwise. Use the accessor $ to create this column: wage2$college =  . . .

Question: How many columns does wage2 have once you add this one? Use NCOL to see.

C. Calculate the sample mean and sample variance for wage2$college  ==  TRUE

In a new code chunk, create a new object called meanCollege that is equal to the sample mean of wage for those observations where wage2$college==TRUE (college workers).

Then, create a new object called varCollege that is equal to the sample variance of wage for those observations where wage2$college==TRUE.

Then, create a new object called nCollege that is equal to the number of observations where wage2$college==TRUE. Note that you can sum a logical vector to get the number of TRUE entries: nCollege  =  sum(wage2$college==TRUE).

Finally, use print(meanCollege), print(varCollege), and print(nCollege) to output the mean, variance, and sample size.

D. Again,  but calculate the sample mean and sample variance for wage2$college  ==

FALSE

Repeat  C, but with wage2$college==FALSE  (high school-only workers).   Call the variables meanHS, varHS, and nHS and print them as in C.

E. Calculate the standard error of the mean for college attendees and high school-only workers.

Remember, our formula from Stats Review:

se = 4  

Where s2  is the sample variance, and n is the sample size.  You already have objects that hold the sample equivalent of each of these things:  varCollege and nCollege.   These sample esti- mates are used to calculate the standard error of the mean for college workers:  semCollege  = sqrt(varCollege/nCollege). Calculate and print the standard error of the mean for college and high school-only workers.

Question:  Which statistic has a higher dispersion (spread), the mean wage of college workers or the mean wage of HS workers?

3.  Hypothesis testing:  difference between two means

A. Calculate the standard error of the difference of two means

We know how to calculate the standard error of each of the means, but we are interesting in the question: is there a difference in average wages between college and high school-only workers? This is a question about the difference in means.

Luckily, we already have the ingredients to generate our test statistic:

sediff  = sewagecollege wagehs   = 4  +  

The standard error of the difference in means looks just like the usual standard error of the mean, but we re adding together the variances before taking the square root.  For every element in the right-hand-side (RHS) of that equation, you have the data as an object in R.

Calculate meanDiff  = meanCollege  - meanHS and calculate the standard error of the differ- ence of those two means using the formula above. Print both meanDiff and semDiff.

Question: In your own words, what does the result for meanDiff mean?  Note: if you use a $, you have to add an extra backslash before it ($), otherwise, Rmarkdown thinks youre trying to write an equation.

B. Hypothesis testing difference in means

We have our new random variable, the difference in means, and we know the standard error of the mean for that difference.  We can build a 95% confidence interval around that difference and test to see if 0 is inside that interval. If it is, then we cannot reject the hypothesis that there is no difference in wages for college and HS-only workers. The formula for a 95% confidence interval for any random variable (given the mean and std. error) is:

−tcrit  × sediff  wagecollege wageHS  < +tcrit  × sediff

You already calculated sediff  and saved it as semDiff. You also already have wagecollege − wageHS saved as meanDiff from A. All we need is tcrit. Since we used sample variance, we know that we need to use a t-distribution with n − 1 degrees of freedom. Since we have two different n’s, we use the larger of the two.

Do the following:

 Find the max n and save it as maxn  = max(nCollege,  nHS)

Find the degrees of freedom dfn  = maxn  -  1

Find tcrit . We can do this by using Rs qt function, which takes two arguments

  The first argument is the percentile you are looking for. So if you want the median value of t distributed variable, you’d use .50. We want the .025th and the .975th (so that we get the 95% confidence interval).

  The second argument is the degrees of freedom, dfn.

  Put them together: tcrit  =  qt( .975,  dfn)

•  Calculate the lower and upper bounds of the 95% confidence interval and print them.  No answer in writing necessary here. Just print the bounds.

C. Interpreting the results

Based on the 95% confidence interval in B, can we answer the question  is the difference in mean wages for college-educated workers and high school-only workers equal to zero?”

Question: What is your answer to this question, in your own words, and why?