---
title: "ADA1: Class 13, Correlation, intro"
author: "Your Name Here"
date: "`r format(Sys.time(), '%B %d, %Y')`"
output:
html_document:
toc: true
---
Include your answers in this document in the sections below the rubric.
# Rubric
1. (0 p) Participate in two data collection and entering activities.
2. (3 p) Interpret correlation for Males, Females, and Everyone combined.
3. (1 p) How would the correlation change if both hand span and height were measured in inches?
4. (2 p) Why is there a difference in the strength of the correlation for everyone compared to either gender separately?
5. (2 p) Describe the relationships between the scores and the guessed score.
6. (2 p) Identify and explain the most surprising feature of these data.
---
# Height vs Hand Span
In a previous year, this was the procedure for collecting data:
1. Record your height in inches. For example 5'0" is 60 inches.
2. Use a ruler to measure your hand span in centimeters:
the distance from the tip of your thumb to pinky finger
with your hand splayed as wide as possible.
3. Have someone from your table enter your measurements at this link (as well as your gender):
[link not provided here]
4. Analysis.
## Data and Plots
```{R}
library(tidyverse)
# Height vs Hand Span
dat_hand <-
read_csv("ADA1_CL_13_Data-CorrHandSpan.csv") %>%
na.omit() %>%
mutate(
Gender_M_F = factor(Gender_M_F, levels = c("F", "M"))
)
str(dat_hand)
cor_dat_hand <-
tribble(
~Gender, ~Corr
, "All", dat_hand %>%
summarize(corr = cor(Height_in, HandSpan_cm)) %>% pull()
, "M" , dat_hand %>% filter(Gender_M_F == "M") %>%
summarize(corr = cor(Height_in, HandSpan_cm)) %>% pull()
, "F" , dat_hand %>% filter(Gender_M_F == "F") %>%
summarize(corr = cor(Height_in, HandSpan_cm)) %>% pull()
)
cor_dat_hand
```
```{R, fig.height = 6, fig.width = 6}
# Plot the data using ggplot and ggpairs
library(ggplot2)
library(GGally)
p1 <- ggpairs(dat_hand %>% select(Gender_M_F, Height_in, HandSpan_cm)
, mapping = ggplot2::aes(colour = Gender_M_F)
, lower = list(continuous = "smooth")
, diag = list(continuous = "density")
#, upper = list(params = list(corSize = 6))
)
print(p1)
```
## Questions to answer
* Interpret correlation for Males, Females, and Everyone combined.
* All:
* Male:
* Female:
* Height was measured in inches and hand span was measured in centimeters.
How would the correlation change if both hand span and height were measured in inches?
* Why is there a large difference in the strength of the correlation for everyone compared to either gender separately?
---
# Word memory scores
15 seconds to memorize 15 words: http://www.randomlists.com/random-words?qty=15
In a previous year, this was the procedure for collecting data:
1. Round 1
1. Put up a list of words for 15 seconds and view.
2. Have 60 seconds to write/type as many words as you can remember.
3. Score yourself (anonymous, so honesty is best -- we're all going to be bad at this).
2. Given your first performance, make a guess at how many words you'll remember in round 2.
3. Round 2 (repeat of round 1)
4. Have someone from your table enter your scores at this link (as well as your gender and student status):
[link not provided here]
5. Analysis.
## Data and Plots
```{R}
# Memory Scores
dat_memory <-
read_csv("ADA1_CL_13_Data-CorrMemoryScores.csv") %>%
na.omit() %>%
mutate(
Gender_M_F = factor(Gender_M_F, levels = c("F", "M"))
, UGrad_Grad = factor(UGrad_Grad)
, EnglishNativeLanguage = factor(EnglishNativeLanguage)
)
str(dat_memory)
cor_dat_memory <-
tribble(
~Gender, ~Corr
, "S1-G2", dat_memory %>%
summarize(corr = cor(Score_1, Guessed_2)) %>% pull()
, "G2-S2" , dat_memory %>% filter(Gender_M_F == "M") %>%
summarize(corr = cor(Guessed_2, Score_2)) %>% pull()
, "S1-S2" , dat_memory %>% filter(Gender_M_F == "F") %>%
summarize(corr = cor(Score_1, Score_2)) %>% pull()
)
cor_dat_memory
```
```{R, fig.width=10, fig.height=10, out.width=600, out.height=600}
# Plot the data using ggplot and ggpairs
library(ggplot2)
library(GGally)
p2 <- ggpairs(dat_memory %>% select(Gender_M_F, UGrad_Grad, EnglishNativeLanguage, Score_1, Guessed_2, Score_2)
, mapping = ggplot2::aes(colour = EnglishNativeLanguage) #, shape = UGrad_Grad)
, lower = list(continuous = "smooth")
, diag = list(continuous = "density")
#, upper = list(params = list(corSize = 6))
, progress = FALSE
)
print(p2)
```
```{R, fig.height = 10, fig.width = 6}
library(ggplot2)
p1 <- ggplot(dat_memory, aes(x = Score_1, y = Guessed_2))
p1 <- p1 + theme_bw()
p1 <- p1 + geom_abline(intercept = 0, slope = 1, linetype = "dashed", alpha = 0.5)
p1 <- p1 + geom_jitter(aes(colour = EnglishNativeLanguage), position = position_jitter(width = 0.1), alpha = 1/2)
p1 <- p1 + geom_smooth(method = lm)
p1 <- p1 + scale_y_continuous(limits=c(0, 15))
p1 <- p1 + scale_x_continuous(limits=c(0, 15))
p1 <- p1 + coord_fixed(ratio = 1)
#print(p1)
library(ggplot2)
p2 <- ggplot(dat_memory, aes(x = Guessed_2, y = Score_2))
p2 <- p2 + theme_bw()
p2 <- p2 + geom_abline(intercept = 0, slope = 1, linetype = "dashed", alpha = 0.5)
p2 <- p2 + geom_jitter(aes(colour = EnglishNativeLanguage), position = position_jitter(width = 0.1), alpha = 1/2)
p2 <- p2 + geom_smooth(method = lm)
p2 <- p2 + scale_y_continuous(limits=c(0, 15))
p2 <- p2 + scale_x_continuous(limits=c(0, 15))
p2 <- p2 + coord_fixed(ratio = 1)
#print(p2)
library(ggplot2)
p3 <- ggplot(dat_memory, aes(x = Score_1, y = Score_2))
p3 <- p3 + theme_bw()
p3 <- p3 + geom_abline(intercept = 0, slope = 1, linetype = "dashed", alpha = 0.5)
p3 <- p3 + geom_jitter(aes(colour = EnglishNativeLanguage), position = position_jitter(width = 0.1), alpha = 1/2)
p3 <- p3 + geom_smooth(method = lm)
p3 <- p3 + scale_y_continuous(limits=c(0, 15))
p3 <- p3 + scale_x_continuous(limits=c(0, 15))
p3 <- p3 + coord_fixed(ratio = 1)
#print(p3)
# grid.arrange() is a way to arrange several ggplot objects
library(gridExtra)
grid.arrange(grobs = list(p1, p2, p3), ncol=1)
```
## Questions to answer
* Describe the relationships between the scores and the guessed score.
* Explain the most surprising feature of these data. In particular, think about the `Guessed_2` score and how its relationship with the scores differs from between the two scores.