--- title: "Assignment 1" subtitle: "STAT3373" author: "Isaac Shoebottom" date: "Sept 18th, 2025" output: pdf_document: default html_document: df_print: paged --- # Question 1 ## a) ```{r} data <- c(14.2, 16.1, 15.8, 17.2, 14.5, 15.3, 16.8, 15.9, 14.7, 16.4, 15.1, 17.5, 15.6, 16.2, 14.9, 15.7, 16.9, 15.4, 16.6, 15.2) ``` $$ H_0 : \mu = 15, \space H_\alpha : \mu \neq 15 $$ $$ n = 20, \space \alpha = 0.05, \space \bar{x}=15.8$$ ```{r} (mean(data) - 15)/(sd(data)/sqrt(20)) # t-value qt(1 - (0.05/2), 20-1) # critical t-value ``` Because t is greater than the critical t, 3.910959 \> 2.093024, we can reject the null hypothesis. The medicine does not take effect in 15 minutes ## b) ```{r} (interval <- qt(1 - (0.05/2), 20-1) * (sd(data)/sqrt(20))) # Interval from mean mean(data) - interval mean(data) + interval ``` The confidence interval with 95% confidence is [15.37186, 16.22814] # Question 2 ## a) ```{r} before <- c(72, 68, 75, 81, 69, 73, 77, 70, 74, 79) after <- c(78, 71, 80, 85, 76, 75, 82, 76, 79, 84) diff <- after - before ``` $$ H_0 : \mu \leq 0, \space H_\alpha : \mu > 0$$ $$ n = 10, \space \alpha = 0.01, \space \bar{d}=4.8$$ ```{r} mean(diff)/(sd(diff)/sqrt(10)) # t-value qt(1 - (0.01/2), 10 - 1) # critical t-value ``` Because t is greater than critical t, 10.28571 \> 3.249836, we can reject the null hypothesis. The method does improve test scores ## b) ```{r} (interval <- qt(1 - (0.01/2), 10-1) * (sd(diff)/sqrt(10))) # Interval from mean mean(diff) - interval mean(diff) + interval ``` The confidence interval with 99% confidence is [3.28341, 6.31659]