We’ll use the penguins dataset for these exercises.
For the first few questions, we’ll use just the Adelie penguin
data.
Here’s some R-code to create a dataset containing only the Adelie
penguins:
require(palmerpenguins)
## Loading required package: palmerpenguins
dat_ade = droplevels(subset(penguins, species == "Adelie"))
Let’s look at a histogram:
hist(dat_ade$body_mass_g, main = "Adelie Penguins: Body Mass", xlab = "body mass (g)")
That seems like a weird distribution… Let’s see if we can figure out what’s going on.
Here’s my version of some boxplots, conditioned on sex:
For practice, let’s do a one-sample t-test. Recall that by default,
when you provide the t.test()
function with a group of
measurements, it performs a one-sample t-test of the null hypothesis
that the mean of the the group is equal to zero.
t.test()
. Specifically, check
out the mu
and alternative
arguments.Q3 (1 pt.): Describe your conclusions based on the p-value of the t-test.
Q4 (1 pt.): Now, conduct a slightly less silly test: perform a one-sample t-test of the alternative hypothesis that male Adelie penguins have a mean body mass greater than 4000 grams. Is this a one- or two-tailed test?
Q5 (1 pt.): Describe your conclusions based on the p-value of the t-test.
Now, let’s compare male and female Adelie penguins.
For the sake of completeness, let’s try a directional hypothesis too:
Finally, just to cover all of our bases and gain some intuition about two-tailed tests, let’s try the other possible direction: Test the alternative hypothesis that male Adelie penguins are lighter than females.