In: Statistics and Probability
Based upon the appropriate test, is there a difference in the frequency of Vomit2 by Head_in? Yes or No, and explain why you indicated yes or no.
> vomit2_headintable <- table(vomit2, head_in)
> vomit2_headintable
head_in
vomit2 0 1
0 305 639
1 1 10
You need to perform a chi square test of independence with following hypothesis -
Null Hypothesis - H0: The variables 'vomit2' and 'head_in' are independent.
Alternate Hypothesis - H1: The variables 'vomit2' and 'head_in' are not independent.
Significance level = = 0.05
You need to run following command in R to get the Chi-Square test output -
chisq.test(vomit2_headintable)
This gives following output -
Pearson's Chi-squared test with Yates' continuity correction data: data X-squared = 1.7313, df = 1, p-value = 0.1883
Warning message: In chisq.test(data) : Chi-squared approximation may be incorrect
If you want the output without the continuity correction, then use -
chisq.test(vomit2_headintable, correction = FALSE)
This gives following output -
Pearson's Chi-squared test data: data X-squared = 2.692, df = 1, p-value = 0.1009
Warning message: In chisq.test(data, correct = FALSE) : Chi-squared approximation may be incorrect
As the p-value is greater than the significance level of 0.05 in both the cases, so we can easily say that we fail to reject the null hypothesis and thus, there isn't enough evidence in the data to support the claim that the two variables 'vomit2' and 'head_in' are not independent.
So, we can say that the two variables are independent.
So, we can say that there is no difference in frequency of vomit2 by head_in.
__________________________________________________