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

ECON 400, Fall 2022

Assignment 1

Instructions

This assignment is due by 11:59pm on Thursday, September 1. It is your responsibility to allow enough time before submission to safeguard against technical glitches. Submit your answers on Gradescope.                                                                                                              You must first attempt the entire assignment on your own.   After that, you may work with classmates if you would like.  This should be a bona fide collaboration, not simply sharing answers.  You may use the textbook, slides, notes from class, etc. as you work on the problems.

Important: Follow the rounding and reporting guidelines as described on Sakai. Questions for which you must upload a file are marked with an asterisk (*); for these questions, you must show your work. Files uploaded to Gradescope must be in pdf, jpg, or png format.

Part 1: Analytical problems

1.  (16 points) You have the following small dataset with information on ACT scores and college GPA for five students.

Student      ACT, x      GPA, y

1            23            2.7

2            27            3.4

3            26            3.1

4            25            3.5

5            30            3.8

Compute each of the following summary statistics.

1.1. The sample mean ACT score, x

1.2. The sample mean GPA, y

1.3. The sample variance of ACT scores,  x(2)

1.4. The sample variance of GPA,  y(2)

1.5. The sample standard deviation of ACT scores,  x

1.6. The sample standard deviation of GPA,  y

1.7. The covariance between ACT scores and GPA,  x,y

1.8. The correlation coefficient between ACT scores and GPA, rx,y

2.  (16 points) You are studying the 20 highest paid CEOs in the U.S. in 2019 and have

calculated various summary statistics:  the mean, standard deviation, median, and in- terquartile range. After doing these calculations, you realize that the eighth-highest paid CEO in your original list, Satya Nadella of Microsoft, also had stock options that you forgot to include in your measure of his compensation. You add the stock options to his compensation and then re-compute all of the summary statistics.  Say whether each of the following will change, may change, or will not change after you fix the data error.

2.1. mean

2.2.  standard deviation

2.3. median

2.4. interquartile range

3.  (10 points) Suppose you have a biased coin: on each flip, the probability of getting heads is 0.6. You flip this coin twice.

3.1. What is the probability of getting at least one heads?

3.2. What is the probability of getting at least one tails?

4.  (12 points) The board of directors of Tar Heel Industries consists of eight men and four women. A three-member search committee is to be chosen at random from among the board of directors to conduct a nationwide search for a new company president. (Note that because the search committee members are chosen without replacement” from the board, the selections are not independent trials.)

4.1. If the first person chosen is a woman, what is the probability that the second person chosen is also a woman?

4.2. If the first two people chosen are women, what is the probability that the third person chosen is also a woman?

4.3. What is the probability all three members of the search committee will be women?

5.  * (10 points) Email spam unsolicited messages sent in bulk is a nuisance for email

users and providers. One estimate indicates that 45 percent of all email sent in 2021 was spam. Suppose that Alphabet, the parent company of Google, has hired you to improve the spam detection in Gmail, an email service.  You use recent advances in machine learning to build a system that will correctly identify 95 percent of spam messages,

while only incorrectly flagging 1 percent of valid messages as spam.  If your system identifies a message as spam, what is the probability that it is actually spam?

Part 2: Empirical problems

The file mobility .Rdata, available on Sakai, is the data on upward mobility in the U.S. that you saw during the first week of class. To complete the problems below, you should first install R and RStudio (see my email with instructions). You should also open RStudio and install the tidyverse packages by typing install .packages("tidyverse") into the console.

6.  (16 points) Once you have downloaded the data file to your computer, you can simply double-click the data file to open it in RStudio. Click on mobility in the Environment

panel, or type View(mobility), to view the data. You can answer the questions in this problem simply by browsing the data and the RStudio interface.

6.1. What is upward mobility (am) in Raleigh, North Carolina? Note that you can click the Filter button above the row of variable names to bring up an interface that will allow you to quickly find specific cities, if you want.

6.2. The Gini index is a measure of income inequality. In this data set, it is measured on

a 0– 1 scale, where 0 represents perfect equality (everyone has the same income) and 1 represents perfect inequality (one person has all the income).  What is the Gini index (gini) in Charlotte, North Carolina?

6.3. Click the triangle next to mobility” in the Environment panel to view some at- tributes of each variable in the data set.  Is cz a numeric variable or a character (string) variable?

6.4. Is stateabbrv a numeric variable or a character (string) variable?

7.  (20 points) Enter the following code to create a new data frame that contains the mean and median upward mobility for each state.  This code assumes that you have already followed the instructions above to install the tidyverse packages, and that you have opened the mobility data file.

library(dplyr)

statsbystate <- mobility %>%

group_by(statefips) %>%

summarize(average  = mean(am,  na .rm  = TRUE), median  = median(am,  na .rm  = TRUE),  sd  =  sd(am,  na .rm  = TRUE))

You may also want to review the introduction to R video that I posted, in which I explain what the various parts of this code do. After running the code, you can click on statsbystate in the Environment panel to open the new data frame.

7.1. What is mean upward mobility (am) among commuting zones in Virginia? 7.2. What is median upward mobility among commuting zones in Virginia?

7.3. Based only on the mean and median, is the distribution of upward mobility among

commuting zones in Virginia skewed left or skewed right?

7.4. What is the standard deviation of upward mobility among commuting zones in

Virginia?

7.5. When there is only one commuting zone in a state, is the standard deviation infinite, zero, or undefined?