Chi-squared test with R programming
Results: Running a New Hypothesis Test
LATEST SUBMISSION GRADE
0%
1.
Question 1
Suppose you want to compare the proportions of overweight and cancer. First, define your variables:
1
2
3
cancer <- g$cancer
overweight <- ifelse(g$bmi >= 25, 1, 0)
Have a look at your new variable to check everything makes sense:
1
2
3
4
5
6
7
table(overweight)
overweight
0 1
34 32
Next perform a chi-squared test. For best practice, assigning the explanatory variable to x and the dependent variable to y. The “dependent variable” is so named because we are hypothesising that its value depends at least partly on some other variable(s) – called the “explanatory variable(s)”.
1
chisq.test(x = overweight, y = cancer)
What did you get? What do you conclude?
Enter the p value in the box below (to 2 decimal places) and tick which of the given options for the conclusion you agree with.
0 / 1 point
p-value = 0.6497
Incorrect
The answer you gave is not a number.
2.
Question 2
Tick which of the below given options for the conclusion you agree with.
0 / 1 point
Being overweight gives you cancer
Being overweight protects you from getting cancer
Being overweight does not give you cancer
There is no association between being overweight and cancer
There is good evidence of an association between being overweight and cancer
There is no evidence of an association between being overweight and cancer anywhere in the world
There is no evidence of an association between being overweight and cancer in this data set
Incorrect
Incorrect. p=0.65, so you have to accept the null hypothesis of no association.