The confidence interval for angiography (range of about 1.1) is smaller than the confidence interval for bypass surgery (range of about 1.5) at a confidence level of 90%.
Question 2
Code
# Point estimatep <-567/1031p
[1] 0.5499515
The point estimate p for the proportion of all adult Americans who believe that a college education is essential for success.
Through this test, I am 95% confident that the true proportion of all adult Americans who believe a college education is essential for success lies between 0.549 and 0.551.
The size of the sample should be at least 370 people. Since they want a confidence interval within 5 dollars and they assume the standard deviation is a quarter of the range of 30 dollars to 200 dollars, I was able to use the confidence interval equation to find the missing variable of sample size. The confidence level is 95%, meaning that with a large sample size, the t-score would be around 2.26, allowing me to use the equation and isolate the sample size.
Question 4
Part A
Ho: The true mean income of female employees is $500/week
Ha: The true mean income of female employees is not $500/week
The p-value is exactly 0.05, meaning it is not smaller than the alpha value of 0.05 and thus is not statistically significant. We do not have enough evidence to reject the null hypothesis. The confidence interval shows that we are 95% confident the true mean income of female employees lies between 340.82 dollars/week and 479.18 dollars/week.
The p-value for the alternate hypothesis that the true mean income of female employees is greater than 500 dollars/week is 0.975. This value is extremely large and greater than the 0.05 alpha level, meaning there is not statistically significant evidence and thus do not reject the null hypothesis.
The p-value for the alternative hypothesis that the true mean income of female employees is less than 500 dollars/week is 0.025. This value is less than the alpha value of 0.05, meaning it is statistically significant and we can reject the null hypothesis. The true mean income of female employees is likely less than 500 dollars/week.
For Jones’s study, the results were not statistically significant because the p-value of 0.51 is greater than the alpha value of 0.05. For Smith’s study, the results were statistically signficiant because the p-value of 0.49 is less than the alpha value of 0.05.
Part C
Reporting the result of a test as P being greater or less than the alpha value can be misleading if the p value is not reported. In both studies, the p-value was .01 away from 0.05, yet in only one study was the result statistically significant. A small p-value may still be meaningful to report because it still shows that there was a relatively small probability of getting the result that one did. Not reporting the p-value when reporting the result and whether or not a hypothesis is rejected leaves an important part of the study out. Someone simply reading that a hypothesis was not rejected without knowing the p-value may assume the p-value was very large even when it was small (such as in the case of Smith vs. Jones), thus leaving out a major aspect of the study.
One Sample t-test
data: gas_taxes
t = -1.8857, df = 17, p-value = 0.03827
alternative hypothesis: true mean is less than 45
95 percent confidence interval:
-Inf 44.67946
sample estimates:
mean of x
40.86278
The p-value of this test is 0.038, which is less than the alpha value of 0.05. This means that there is statistically significant evidence and we can reject the null hypothesis, that the true average gas tax per gallon in the United States is 45 cents. There is significant evidence to suggest that the true average gas tax per gallon in the United States is less than 45 cents.
Source Code
---title: "Kimble HW 2"author: "Karen Kimble"desription: "Homework 2 for DACSS 603"date: "10/17/2022"format: html: toc: true code-fold: true code-copy: true code-tools: truecategories: - hw2 - karen---```{r}# Setuplibrary(tidyverse)library(stats)knitr::opts_chunk$set(echo =TRUE)```## Question 1### Angiography```{r}confidence_level <-0.90tail_area <- (1-confidence_level)/2standard_error <-9/sqrt(847)t_score <-qt(p =1-tail_area, df =846)CI_1 <-c(18- t_score * standard_error, 18+ t_score * standard_error)print(CI_1)```### Bypass Surgery```{r}confidence_level <-0.90tail_area <- (1-confidence_level)/2standard_error <-10/sqrt(539)t_score <-qt(p =1-tail_area, df =538)CI_2 <-c(19- t_score * standard_error, 19+ t_score * standard_error)print(CI_2)```The confidence interval for angiography (range of about 1.1) is smaller than the confidence interval for bypass surgery (range of about 1.5) at a confidence level of 90%.## Question 2```{r}# Point estimatep <-567/1031p```The point estimate p for the proportion of all adult Americans who believe that a college education is essential for success.```{r}# Confidence Intervalconfidence_level <-0.95tail_area <- (1-confidence_level)/2standard_deviation <-sqrt((p * (1-p))/1031)standard_error <- standard_deviation /sqrt(1031)t_score <-qt(p =1-tail_area, df =1030)CI_3 <-c(p - t_score * standard_error, p + t_score * standard_error)print(CI_3)```Through this test, I am 95% confident that the true proportion of all adult Americans who believe a college education is essential for success lies between 0.549 and 0.551.## Question 3```{r}sd <- (200-30)/4x <-5/(2.26* sd)sample_size = (1/x)^2sample_size```The size of the sample should be at least 370 people. Since they want a confidence interval within 5 dollars and they assume the standard deviation is a quarter of the range of 30 dollars to 200 dollars, I was able to use the confidence interval equation to find the missing variable of sample size. The confidence level is 95%, meaning that with a large sample size, the t-score would be around 2.26, allowing me to use the equation and isolate the sample size.## Question 4### Part AHo: The true mean income of female employees is \$500/weekHa: The true mean income of female employees is not \$500/week```{r}confidence_level <-0.95tail_area <- (1-confidence_level)/2standard_error <-90/sqrt(9)t_score <-qt(p =1-tail_area, df =8)CI_4A <-c(410- t_score * standard_error, 410+ t_score * standard_error)p_value =2*pt(q = t_score, df =8, lower.tail =FALSE)p_valueprint(CI_4A)```The p-value is exactly 0.05, meaning it is not smaller than the alpha value of 0.05 and thus is not statistically significant. We do not have enough evidence to reject the null hypothesis. The confidence interval shows that we are 95% confident the true mean income of female employees lies between 340.82 dollars/week and 479.18 dollars/week.### Part B```{r}p_value =pt(q = t_score, df =8, lower.tail =TRUE)p_value```The p-value for the alternate hypothesis that the true mean income of female employees is greater than 500 dollars/week is 0.975. This value is extremely large and greater than the 0.05 alpha level, meaning there is not statistically significant evidence and thus do not reject the null hypothesis.### Part C```{r}p_value =pt(q = t_score, df =8, lower.tail =FALSE)p_value```The p-value for the alternative hypothesis that the true mean income of female employees is less than 500 dollars/week is 0.025. This value is less than the alpha value of 0.05, meaning it is statistically significant and we can reject the null hypothesis. The true mean income of female employees is likely less than 500 dollars/week.## Question 5### Part A```{r}# Jonest_score <- (519.5-500)/(10)t_scorep_value <-2*pt(q = t_score, df =999, lower.tail =FALSE)p_value``````{r}# Smitht_score <- (519.7-500)/(10)t_scorep_value <-2*pt(q = t_score, df =999, lower.tail =FALSE)p_value```### Part BFor Jones's study, the results were not statistically significant because the p-value of 0.51 is greater than the alpha value of 0.05. For Smith's study, the results were statistically signficiant because the p-value of 0.49 is less than the alpha value of 0.05.### Part CReporting the result of a test as P being greater or less than the alpha value can be misleading if the p value is not reported. In both studies, the p-value was .01 away from 0.05, yet in only one study was the result statistically significant. A small p-value may still be meaningful to report because it still shows that there was a relatively small probability of getting the result that one did. Not reporting the p-value when reporting the result and whether or not a hypothesis is rejected leaves an important part of the study out. Someone simply reading that a hypothesis was not rejected without knowing the p-value may assume the p-value was very large even when it was small (such as in the case of Smith vs. Jones), thus leaving out a major aspect of the study.## Question 6```{r}gas_taxes <-c(51.27, 47.43, 38.89, 41.95, 28.61, 41.29, 52.19, 49.48, 35.02, 48.13, 39.28, 54.41, 41.66, 30.28, 18.49, 38.72, 33.41, 45.02)t.test(gas_taxes, alternative =c("less"), mu =45)```The p-value of this test is 0.038, which is less than the alpha value of 0.05. This means that there is statistically significant evidence and we can reject the null hypothesis, that the true average gas tax per gallon in the United States is 45 cents. There is significant evidence to suggest that the true average gas tax per gallon in the United States is less than 45 cents.