Hypothesis Testing Lab

Lab 9

Dr. Elijah Meyer

Duke University
STA 199 - Spring 2023

April 4th, 2023

Announcements

– Project Draft Report Due April 7th

Project Friendly Reminder

– Everyone must contribute (including making commits)

– Everyone must communicate with eachother (missing labs, etc…)

– Merge conflicts are not always a bad thing!

– You will not all earn the same grade if you do not equally contribute

Hypothesis Testing (Extension from class Friday)

\(\mu\) <- population (true) mean

When we have a categorical explanatory variable (grouping variable), our parameter slightly changes….

Hypothesis Testing (Difference in Means)

\(\mu_1 - \mu_2\); difference in population means between each group

Note: In practice, we often provide informative subscripts instead of 1 and 2

Hypothesis Testing (Null and Alternative)

\(H_o\): Assume the true mean for one group is the same as the other

\(H_a\): Research Question

In R (4C)

Extension from Code Friday:

– specify(response = y, explanatory = x) # Now need both and x and y!

– hypothesize(null = “independence”) # looking to see if x and independent of y!

– generate(reps = large.number, type = “permute”) # This is a permutation test. Specify this here!

– calculate(stat = “diff in means”, order = c(“group1”, “group2”)) #Our statistic has changed. Specify this here!

Alpha (Significance Level)

\(\alpha\) can be used as a cut off value to make decisions and conclusions

\(\alpha\) - is also our type one error rate

Type 1 Error: Reject the null hypothesis when we should not (when the null hypothesis is actually true)

Alpha (Significance Level)

We as researchers choose this value based on what we want to set our type 1 error rate to be

That is, if we perform many many tests under the same conditions, if the null hypothesis is actually true, we would reject the null hypothesis about 5% of the time

Bonferroni Correction

– The Bonferroni correction is an adjustment made to alpha when several statistical tests are being performed

Bonferroni Correction: \(\frac{\alpha}{n}\)

Where \(\alpha\) is our significance level

Where n is the number of tests being done