Show enough work to explain your decisions. Include the relevant R output where requested and state conclusions in context. Use \(\alpha=0.05\) for all three problems.
In professional basketball games during the 2009-2010 season, when
Kobe Bryant of the Los Angeles Lakers shot a pair of free throws, 8
times he missed both, 152 times he made both, 33 times he made only the
first shot, and 37 times he made only the second. Is it possible that
the successive free throws are independent, or is there evidence to
suggest a “hot streak” effect? The data are tabulated in the
freethrow data frame below:
| Make 2nd | Miss 2nd | |
|---|---|---|
| Make 1st | 152 | 33 |
| Miss 1st | 37 | 8 |
## Code for table
freethrow <- matrix(c(152,33,37,8), nrow = 2, byrow = TRUE)
rownames(freethrow) <- c("Make 1st", "Miss 1st")
colnames(freethrow) <- c("Make 2nd", "Miss 2nd")
chisq.test() (use the
argument correct = FALSE to ensure you find the same \(\chi^2\) statistic as you did in (3))Recall from the Odds Funsheet that odds compare the number of times an event occurs to the number of times it doesn’t. Here, the odds of red among cars are the number of red cars divided by the number of blue cars. The odds ratio compares those odds to the odds of red among trucks. An odds ratio of 1 means equal odds; a value above 1 means the odds of red are higher among cars.
Two hypothetical studies record the type and color of independently observed vehicles. Study B counts ten times as many vehicles in every cell.
| Red | Blue | |
|---|---|---|
| Car | 32 | 28 |
| Truck | 18 | 22 |
| Red | Blue | |
|---|---|---|
| Car | 320 | 280 |
| Truck | 180 | 220 |
## Copy these into your R file to use with chisq.test()
## Data for study A
study_a <- matrix(c(32, 28, 18, 22), nrow = 2, byrow = TRUE,
dimnames = list(c("Car", "Truck"), c("Red", "Blue")))
## Data for study B
study_b <- matrix(c(320, 280, 180, 220), nrow = 2, byrow = TRUE,
dimnames = list(c("Car", "Truck"), c("Red", "Blue")))
Partr A: What is the null hypothesis regarding the relationship between vehicle type and color?
Part B: For Study A, calculate the odds of red for cars and for trucks, then find the odds ratio. Interpret it in a sentence using the word odds. Based on this, does there appear to be an association between vehicle type and color?
Part C: Run a \(\chi^2\) test of independence on the
results from Study A using chisq.test(, correct = FALSE).
Report the test statisic, p-values, and degrees of freedom. Based on
this, what conclusion do we come to regarding our null
hypothesis?
Part D: For Study B, find the odds ratio comparing cars to truck. How does this compare to what you found in Part B? Then run a \(\chi^2\) test of independence on Study B. What is your conclusion?
Part E: The odds ratio is a measure of effect size, whereas the \(\chi^2\) test of independence is a measure of strength of evidence against a null hypothesis. Comment on the difference between these two ideas, and explain what role the sample size played in both measures
In Homework 5, we compared the bST and Control groups. Now consider all three groups: Control, Testosterone, and bST. The response is each cow’s weight change (post-treatment minus pre-treatment weight). Assume the conditions for a one-way ANOVA are met. The sample mean changes are \(-0.45\) for Control, \(2.76\) for Testosterone, and \(7.26\) for bST, in the dataset’s recorded weight units.
## Load cow data and create difference variable
cow <- read.csv("https://collinn.github.io/data/cowgrowth.csv")
cow <- cow %>% mutate(Diff = Postwt - Prewt)
summary(aov(Diff ~ Treat, data = cow)) to perform the
ANOVA. Use the two mean squares to show how the F statistic was
calculated. Which mean square measures variability within the
groups?