For this lab you should submit, on Blackboard, your .Rmd and .docx-files at the end of the lab hour. Remember to skim your .docx file before submission.

Let's do some testing!

All commands and all conditions you need for this lab are covered in the Lecture Notes

UberX Earnings

We will look at Exercise 7.27 in the book:

Task Load the book's dataset UberX from "ips9e/Chapter 7/EX07-027UBERX.txt".

Task How many observations is in the UberX dataset?

Task Is this dataset appropriate for T-testing?

Task Using the function t.test, report a 95% confidence interval for the UberX drivers' earnings.

One sample test

Task Using the function t.test, determine whether the mean earnings are significantly larger than $30/h. Use a significance level of 95%, and remember to choose the right alternative hypothesis.

Task Was the result from the test statistically significant?

Budweiser alcohol levels

Now let's look at 7.29.

Task Load the book's dataset Bud from "ips9e/Chapter 7/EX07-029BUD.txt"

Task How many observations is in the Bud dataset?

Task Is this dataset appropriate for T-testing?

Task Using t.test create a confidence interval and test the null hypothesis that the population mean is 4.7 against the alternative that the mean is greater than 4.7. Use a confidence level of 95%.

Task What conclusion can you draw from your test?

Sadness and spending

A group of 31 study participants were assigned to one of two groups and given $10. One group watched a sad scene from a movie, and the other a video with nature scenes from the Great Barrier Reef. Afterwards, the participants were offered to buy an insulated water bottle at a decreasing sales price (first at $10, then at $9.50, ...).

Task Load the book dataset sadness using

sadness = read_delim("ips9e/Chapter 7/EX07-067SADNESS.txt", delim="\t")

(this is required because the data file is corrupted)

Task The dataset has values in the variable Price and group (Sad / Neutral) in the variable Group. How large is each of the two groups?

Task Is this data paired or unpaired?

Task Is this dataset appropriate for a corresponding two-sample t-test?

Task Perform a significance test at \(\alpha=0.05\) against the null hypothesis of no difference between the groups.

Task What conclusion do you draw from your test?

Weight gain

Book exercise 7.38. In a study, 16 non-obese adults were fed 1000 calories per day in excess of the calories needed for a stable body weight. They were weighted before and after maintaining this diet for 8 weeks.

A theoretical module would expect a weight gain of 7.25 kg.

Task Load the book's dataset wtgain from "ips9e/Chapter 7/EX07-038WTGAIN.txt" The weight before is in the variable wtb and the weight after is in wta.

Task Add a new variable with the weight gain.

Task Is this data paired or unpaired?

Task Is this dataset appropriate for a corresponding two-sample t-test?

Task Using t.test create a confidence interval and test the null hypothesis that the weight gain is 7.25 kg against a two-sided alternative. Use a confidence level of 99%.

Task What conclusion can you draw from your test?