Where \mu_1 is the mean for the first-entered group (x)
The order you enter them (x vs y) doesn’t matter, just make sure you set up the directional hypothesis accordingly
3.2 Active pulse rate
Is active pulse rate higher among smokers than non-smokers?
3.3 Weight
Do smokers weight less than non-smokers?
3.4 Exercise
Do smokers and non-smokers exercise the same amount?
Source Code
---title: "BTS 510 Lab 9"format: html: embed-resources: true self-contained-math: true html-math-method: katex number-sections: true toc: true code-tools: true code-block-bg: true code-block-border-left: "#31BAE9"---```{r}#| label: setuplibrary(tidyverse)set.seed(12345)theme_set(theme_classic(base_size =16))```## Learning objectives* *Interpret* tests comparing **two unrelated samples*** *Summarize data* using **contingency tables*** *Describe* different study designs for **contingency tables** ## Data * `Pulse` dataset from the **Stat2Data** package * A dataset with $n$ = 232 observations on the following 7 variables. * `Active`: Pulse rate (beats per minute) after exercise * `Rest`: Resting pulse rate (beats per minute) * `Smoke`: 1=smoker or 0=nonsmoker * `Sex`: 1=female or 0=male * `Exercise`: Typical hours of exercise (per week) * `Hgt`: Height (in inches) * `Wgt`: Weight (in pounds)## Tasks* Make plots of variables as needed (e.g., to assess assumptions)* Conduct a $z$-test, $t$-test, and Welch's $t$-test * What is/are your conclusion(s) based on the tests? * Are the assumptions met? * e.g., large enough sample to justify $z$ test using sample variance * e.g., equal variances in both groups * Which test seems the best choice? (Don't make this decision based on what is significant -- here or elsewhere) * Do you think a non-parametric test might be a good option?### Some useful code* To split the dataset into `Smoke` = 0 and `Smoke` = 1 * There are other ways to do this, so you don't *need* to use this code```{r}library(Stat2Data)data(Pulse)library(tidyverse)Pulse_smoke <- Pulse %>%filter(Smoke ==1)Pulse_nosmoke <- Pulse %>%filter(Smoke ==0)head(Pulse_smoke)head(Pulse_nosmoke)```* Use `alternative = "greater"` if $H_1$: $\mu_1 > \mu_2$ * Use `alternative = "less"` if $H_1$: $\mu_1 < \mu_2$ * Where $\mu_1$ is the mean for the first-entered group (`x`) * The order you enter them (`x` vs `y`) doesn't matter, **just make sure you set up the directional hypothesis accordingly**### Active pulse rate* Is active pulse rate **higher** among smokers than non-smokers?```{r}```### Weight* Do smokers weight **less than** non-smokers?```{r}```### Exercise* Do smokers and non-smokers exercise the **same** amount?```{r}```