X-Git-Url: https://code.communitydata.science/stats_class_2020.git/blobdiff_plain/674fe432955a88fd5e2ad794624367b237f2e384..18fa58b01b5debbe23d96b30fc08432674d5ad88:/os_exercises/ch7b_exercises_solutions.rmd

diff --git a/os_exercises/ch7b_exercises_solutions.rmd b/os_exercises/ch7b_exercises_solutions.rmd
new file mode 100644
index 0000000..f3cc95c
--- /dev/null
+++ b/os_exercises/ch7b_exercises_solutions.rmd
@@ -0,0 +1,71 @@
+---
+title: "Chapter 7 Textbook exercises (part b)"
+subtitle: "Solutions to even-numbered questions  \nStatistics and statistical programming  \nNorthwestern University  \nMTS
+  525"
+author: "Aaron Shaw"
+date: "November 5, 2020"
+output:
+  html_document:
+    toc: yes
+    toc_depth: 3
+    toc_float:
+      collapsed: false
+      smooth_scroll: true
+    theme: readable
+  pdf_document:
+    toc: no
+    toc_depth: '3'
+    latex_engine: xelatex
+header-includes:
+  - \newcommand{\lt}{<}
+  - \newcommand{\gt}{>}
+  - \renewcommand{\leq}{â¤}
+  - \usepackage{lmodern}
+---
+
+```{r setup, include=FALSE}
+knitr::opts_chunk$set(echo = TRUE)
+
+```
+
+
+All exercises taken from the *OpenIntro Statistics* textbook, $4^{th}$ edition, Chapter 7.
+
+# 7.42 Work hours and education
+(a) Hypotheses:
+
+$H_0:$ The mean hours worked for the groups are all equal.
+
+$$\mu_{\lt~hs} = \mu_{hs} = \mu_{jc} = \mu_{ba} = \mu_{grad} $$
+$H_A:$ The mean hours worked vary by education level. In other words, the means are not equal. 
+
+(b) Conditions and assumptions necessary for unbiased ANOVA estimates include:  
+
+Independent observations, normal(ish) distributions, and constant(ish) variance. The problem doesn't say much about the sample to help evaluate the independence of the observations, but it's definitely less than 10% of the population and is likely a fairly good approximation of a random sample (thereby satisfying the rule of thumb). From the boxplots the distributions all look fairly normal. The standard deviations are also similar. We'll assume that the conditions are met for the purposes of the test.
+
+(c) Working across the rows of the table, we can fill in the blanks:  
+
+* The degrees of freedom for degree $= 5-1 = 4$  
+* The Sum of Squares between degree levels $= 501.54 \times 4 = 2006.16$  
+* The F value $= Sum~Sq~degree / Mean~Sq~residuals = 501.54 / 229.12 = 2.189$  
+* The degrees of freedom for Residuals $= 1171-4 = 1167$  
+* Mean Square Residuals (Error) $= 267382/1167 = 229.12$  
+* Total degrees of freedom $=1172 - 1 = 1171$  
+* Total Sum of squares $=2006.16+267382 = 269388.16$  
+
+(d) According to the ANOVA results, we cannot reject the null hypothesis at a $p \leq 0.05$ level, suggesting that the mean number of hours worked per week may be equal across education levels.
+
+# 7.44 Child care hours
+
+(a) 
+$H_0$: Average child care hours is the same for all attainment levels: $\mu_{College}~=~\mu_{TechOrVoc}~=~\mu_{UMS}~=~\mu_{LMS}~=~\mu_{PS}$
+$H_A$: At least one pair of means are different.
+
+(b) Since $p~\gt~0.05$, the results fail to reject $H_0$. The data do not provide convincing evidence of a difference between the average number of hours spent on child care across educational attainment levels.
+
+# 7.46 True/False ANOVA questions
+
+(a) False. The ANOVA procedure does not evaluate the pairwise comparisons, but the overall variation across groups.  
+(b) True, otherwise the F-value will not be large enough to reject the null hypothesis.  
+(c) False. It is possible that none of the pairwise comparisons will be significantly different even if the ANOVA rejects the null.  
+(d) Assuming this question is about the Bonferroni correction, False. The correction does not divide $\alpha$ by the number of groups, but rather the number of pairwise tests. In this case, 4 groups yields ${4}\choose{2} = 6$ pairs, meaning that the corrected value for $\alpha = 0.05/6 = 0.0083$. Other corrections exist even though they were not discussed in the book (and the Reinhart reading) and they may choose other values for $\alpha$ or other procedures.
\ No newline at end of file
