Caitlin Clark finished her career at Iowa as the all-time scoring leader in college basketball. Let's look at some of her stats from last season. Does she tend to score more points at home or away? Six of her top eight point performances were at home where she averages 32.4 points. But, her away average is 31.5 points. Is this a big enough difference for use to be convinced she performs better at home?
First, let's investigate the situation from the video we watched.
Theory: Flies are more attracted to humans that have ingested some beer.
Open up a new code script to keep all your work in. First create two separate vectors for the two experimental conditions. Each number represents the number of flies that went toward the human in each case.
beer <- c(27,20,21,26,27,31,24,21,19) # 9 observations
water <- c(21,22,16,14,21,16,19,15) # 8 observations
How far apart are the means? Run the line below to find out. This is our observed distance. Add the number in a comment and a comment on whether you think think that this represents a "signifnicant" difference...
mean(beer)-mean(water)
How to run a resampling:
values <- c(beer, water) # Combine the data into one vector
differences <- c() # Set up an empty vector for the simulated differences in means
for (i in 1:1000){ # Then, 1000 times we will...
rearranged <- sample(values) # Rearranges the values in a random order
beerSample <- rearranged[1:9] # Chops off the first 9 and calls them "beerSample"
waterSample <- rearranged[10:17] # Chops off the back 8 and calls them "waterSample"
differences[i] <- mean(beerSample)-mean(waterSample) # Finds and stores the difference between the samples.
}
hist(differences) # Looks at the differences in the samples
Looking at the histogram, do you think 6 represents a "significant" difference? Comment on a line of code. Let's figure out how common a difference of 6 really is...
bigDifferences<-subset(differences,differences>=6)
length(bigDifferences)/1000
Based on this then... is 6 a "significant" difference? Comment in a line of code.
Is Caitlin Clark better at home or away? Here are vectors with her point totals for the 2023-2024 season:
home <- c(28,24,35,24,35,35,40,30,32,38,27,49,24)
away <- c(24,35,28,29,26,45,35,38,31,24)