---
title: "TEST 2"
author: "Alizeh Azhar"
date: "11/13/2021"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Always, Sometimes, or Never (10 points)

(10 points) The following statements are always, sometimes, or never true. Mark each statement with Always, Sometimes, or Never, depending on the truth of each statement.

1.  A 99% confidence interval is wider than a 95% confidence interval.\
    \textcolor{blue}{Always. Increasing the confidence level increases the level bound,making the confidence interval wider.}

2.  In the U.S. court system, a Type I error would be imprisoning a guilty person.\
    \textcolor{blue}{Never- this is not an error.}

3.  A test rejected at a 10% significance level would be rejected at a 5% significance level.\
    \textcolor{blue}{Sometimes- consider two p-values: 0.04 and 0.007. It is only rejected at 5\% significance level.}

4.  A p-value is the chance of a Type I error.\
    \textcolor{blue}{Always. The probability of making a type I error is represented by your alpha level ($\alpha$), which is the p- value below which you reject the null hypothesis. A p- value of 0.05 indicates that you are willing to accept a 5\% chance that you are wrong when you reject the null hypothesis.}

5.  The tails of a t-distribution with 20 degrees of freedom are thicker than the tails of a t-distribution with 10 degrees of freedom.\
    \textcolor{blue}{Never- as the degrees of freedom increase, the tails get thinner and the t - distribution gets closer to the standard normal distribution.}

6.  I construct a 99% confidence interval for a mean difference that contains 0. A two-sided hypothesis test on the same data is rejected at a 1% significance level.\
    \textcolor{blue}{Never- 0 is not included in the interval, so it is not a reasonable value for the true mean difference. The test will be rejected.}

7.  The significance level is the chance that the null hypothesis is true.\
    \textcolor{blue}{Never- the significance level is the chance of a Type I error.}

8.  If a p-value is greater than $\alpha = 0.05$, we accept the null hypothesis.\
    \textcolor{blue}{NEVER. The null hypothesis never, ever accepted. You should only ever fail to reject the null hypothesis.}

9.  You have made a Type I error if you fail to reject the null hypothesis.\
    \textcolor{blue}{Sometimes-it depends on if the null hypothesis is true or not.}

10. A test rejected at a 5% significance level would be rejected at a 10% significance level.\
    \textcolor{blue}{Always: Any p-value that is less than 0.01 is also less than 0.05.}

\newpage

# Matching Analysis Methods (10 points)

Match the quantities described below to the correct notation. The terms may be used once, more than once, or not at all.

1.  Do hurricanes with male names act differently than hurricanes with female names? A climate scientist compares estimated damage (in US dollars) from a random sample of hurricanes with male and female names.\
    \textcolor{blue}{2-sample t- test}

2.  A researcher wants to compare the average blood pressure for young women taking hormonal birth control to the average blood pressure for young women not taking hormonal birth control.\
    \textcolor{blue}{2- sample t- test}

3.  A team of statisticians analyzes Census Bureau data to find if the average number of COVID infections in households that celebrated a birthday in the past two weeks is different from the average number of infections in households that did not celebrate a birthday.\
    \textcolor{blue}{2- sample t- test}

4.  A student newspaper takes a random sample of students and faculty to see if the proportion of each group who has watched the Netflix series *The Chair* is different.\
    \textcolor{blue}{2- Proportion Z- test}

5.  TripAdvisor estimated that in 2020, 56% of people in the US traveled for Thanksgiving. They plan to take a new sample of people to see if the value has changed in 2021\
    \textcolor{blue}{1- Proportion Z- test}

6.  Experts suspect that the proportion of Democrats who have natural immunity against COVID-19 (i.e., became ill and recovered) is less than the proportion of Republicans who have natural immunity against COVID-19.\
    \textcolor{blue}{2- Proportion Z- test}

7.  The stated miles-per-gallon (mpg) for a Mazda CX-5 is 25. An owner of a Mazda CX-5 takes a random sample of 40 measurements to see if their car has a lower mean mpg.\
    \textcolor{blue}{1- sample t- test}

8.  The average price per pound of frozen turkey in 2019 was \$0.81. A poultry farmer takes a random sample of prices from different stores and brands to see if the value has changed in 2021.\
    \textcolor{blue}{1- sample t- test}

9.  A researcher compares the rates of underweight babies born to parents with health insurance and underweight babies born to parents without health insurance to see if there is a difference.\
    \textcolor{blue}{2-Proportion Z-test}

10. . Department store management claims that "most people" (i.e., more than 50%) want to shop there on Thanksgiving. An employee takes a sample of past customers to try and see if the claim is true to see if they need to schedule workers on that day\
    \textcolor{blue}{1- Proportion Z- test}

\newpage

# Holiday Spending (5 points)

1.  Which test should be used to see if the mean log amount of money Americans are planning on spending on Christmas gifts in 2020 has increased from the mean log amount of money Americans spend on Christmas gifts in 2019, log(\$846)?\
    \textcolor{blue}{(b)- One-sample t-test}

2.  What are the correct hypotheses for testing to see if the mean log amount of money Americans are planning on spending on Christmas gifts in 2020 has changed from the mean log amount of money Americans spend on Christmas gifts in 2019, log(\$846)?\
    \textcolor{blue}{(d)- $H_0:\mu= log(846)$ vs $H_A: \mu \neq log(846)$}

3.  What is the test statistic?\
    \textcolor{blue}{The test statistic is: t= 0.68463}

4.  What is the p-value?\
    \textcolor{blue}{The test statistic is: p= 0.2477}

5.  Could you have made a Type I error? Why?\
    \textcolor{blue}{(a)- No, because we failed to reject the null}

# Airline Delays (5 points)

1.  Which test should be used to see if the mean carrier delay length decreased from 2019 to 2020?\
    \textcolor{blue}{Two-sample t-test}

2.  What are the correct hypotheses for testing to see if the mean delay decreased from 2019 to 2020?\
    \textcolor{blue}{(a)- $H_0: \mu_{2019}\leq \mu_{2020}$ vs $H_A: \mu_{2019}> \mu_{2020}$}

3.  What is the test statistic?\
    \textcolor{blue}{The test statistic is: t= 6.2791}

4.  What is the p-value?\
    \textcolor{blue}{The p- value is: p= 8.945e-09}

5.  Would you trust these results?\
    \textcolor{blue}{(d)- No, the data are not normal.}

\newpage

# Gift Giving for Pets (5 points)

1.  Which test should be used to see if the proportion of millenial American pet owners who gave their pets a gift for the holidays is different from the overall proportion of American pet owners who gave their pets a gift for the holidays?\
    \textcolor{blue}{(d)- One-proportion z-test.}

2.  What are the correct hypotheses for testing to see if the proportion of millenial American pet owners who gave their pets a gift for the holidays is different from the overall proportion of American pet owners who gave their pets a gift for the holidays?\
    \textcolor{blue}{(d)- $H_0: p= 0.47$ vs $H_A: p \neq 0.47$}

3.  Would you reject or fail to reject this test at a significance level of 0.01?\
    \textcolor{blue}{(b)- Fail to reject, since the p-value is greater than $\alpha$ = 0.01}

4.  Is there evidence of a significant difference in the proportion of millenial American pet owners who bought their pets a holiday gift?\
    \textcolor{blue}{(c)- No, because we failed to reject the null hypothesis}

5.  Could you compare these results to a 99% confidence level?\
    \textcolor{blue}{(d)- (d) Yes, because hypothesis tests can always be compared to confidence intervals.}

# In Person Voting (5 points)

1.  Which test should be used to see if fewer voters aged 65 years and older voted in person than voters aged 18-29?  
\textcolor{blue}{(d)- Two-proportion z-test}

2.  What are the correct hypotheses for testing to see if there is a difference in the proportions of people who voted in person between the two age groups?  
\textcolor{blue}{(c)- $H_0: p_{18-29} \leq p_{65+}$ vs $H_0: p_{18-29} > p_{65+}$}

3.  Would you reject or fail to reject this test at a significance level of 0.10?  
\textcolor{blue}{(c)- Reject, since the p-value is less than $\alpha$ = 0.10}

4.  Is there evidence of a significant difference in the proportions of people who voted in person between the two age groups?  
\textcolor{blue}{(b)- Yes, because we rejected the null hypothesis}

5.  Would 0 be included in a 90% confidence level?  
\textcolor{blue}{(a)- No, because the alternative is not two-sided}
