Clone the hw-03- repo and start a new project in RStudio. For more detailed instructions about getting started, see the Lab 01 instructions
Type the following lines of code in the console in RStudio filling in your Github username and the email address associated with your Github account.
library(usethis)
use_git_config(user.name = "your github username",
user.email="your email")
Now that we’ve had some practice with doing data wrangling, data visualization, and fitting models in R, let’s consider a few tips to help neatly format your analysis.
patchwork
or similar packages to arrange multiple plots in a neat and organized way.tidy
and kable
.We will use the following packages in this assignment:
library(tidyverse)
library(broom)
library(knitr)
library(patchwork)
#add other packages as needed
In a 1991 study, Allen et. al sought to answer whether the presence of a close friend or pet affected a woman’s stress levels as she completed a challenging tasks. To test this, they conducted an experiment in which 45 women who were dog-owners were tasked with counting backwards by 13s or 17s under one of three test conditions (group
):
C
: Control group, AloneF
: Close friend presentP
: Pet presentAll of the participants were dog-owners who responded to an advertisement about the study.
The data is available in stress-experiment.csv
in the data
folder.
To quantify stress level, they measured each woman’s heart rate and blood pressure after she completed the task. For today’s analysis, we will focus on the heart rate (heart_rate
).
We will use Analysis of Variance (ANOVA) to test whether there is an association between the presence of a friend or pet and stress level when completing challenging tasks.
Visualize the distribution of heart rate and calculate summary statistics for each group.
What do you observe from the visualizations and summary statistics? In your response, describe how the centers and spreads compare across groups, presence of outliers, and whether there appears to be a relationship between the testing conditions and heart rate.
Make an ANOVA table for this data. Show your code and output.
State the hypotheses that are being tested in the ANOVA table using (i) words and (ii) statistical notation. Hint: You can use this guide to find the LaTex code needed to write the hypotheses.
Based on your table,
Write your responses in the context of the data.
In June 2020, Garbe, Rau and Toppe published the paper Influence of perceived threat of Covid-19 and HEXACO personality traits on toilet paper stockpiling. The objective their analysis was to examine the relationship between personality traits, perceived threat of Covid-19 and stockpiling toilet paper.
They conducted an online survey March 23 - 29, 2020 and used the results to fit multiple linear regression models to draw conclusions about their research questions. From their survey, they collected data on adults across 35 countries. Given the small number of responses from people outside of the United States, Canada and Europe, only responses from people in these three locations were included in the regression analysis.
Let’s consider their results for the model looking at the effect on perceived threat of Covid-19. The model can be found on page 6 of the paper. The perceived threat of Covid was quantified using the responses to the following survey question:
How threatened do you feel by Coronavirus? [Users select on a 10-point visual analogue scale (Not at all threatened to Extremely Threatened)]
Age
(0.072) in the context of the analysis.Total | 50 |
---|---|
Part 1: Conceptual questions | 25 |
Part 2: Analysis in Practice | 20 |
Document submitted as PDF with clear headers | 2 |
Name and date updated in YAML | 1 |
At least 3 informative commit messages | 2 |