Solution:
We are given that following table:
Excellent | Good | Fair | Poor | Total | |
Less than high school | 72 | 202 | 199 | 62 | 535 |
High school | 465 | 877 | 358 | 108 | 1808 |
Junior College | 80 | 138 | 49 | 11 | 278 |
Bechelor | 229 | 276 | 64 | 12 | 581 |
Graduatrs | 130 | 147 | 32 | 2 | 311 |
Column Totals | 976 | 1640 | 702 | 195 | 3513 |
We have to use R to test the if there is evidence to suggest that health and education are related.
Hypothesis for this test are:
H0: health and education are not related or are independent.
Vs
H1: health and education are related or are dependent.
We use following R code: Copy this code and paste it in R and Run.
> Input =("
+ Injection.area Excellent Good Fair Poor
+ Less_than_High_School 72 202 199 62
+ High_School 465 877 358 108
+ Junior_College 80 138 49 11
+ Bachelor 229 276 64 12
+ Graduate 130 147 32 2
+ ")
> Matriz = as.matrix(read.table(textConnection(Input),
+
header=TRUE,
+
row.names=1))
> Matriz
Excellent Good Fair Poor
Less_than_High_School 72
202 199 62
High_School
465 877 358 108
Junior_College
80 138 49 11
Bachelor
229 276 64 12
Graduate
130 147 32 2
> chisq.test(Matriz,
+
correct=TRUE)
Pearson's Chi-squared test
data: Matriz
X-squared = 285.061, df = 12, p-value < 2.2e-16
From the above R code output, we have Chi-square test statistic value = 285.061 and corresponding p-value = 2.2e-16 = 0.0000.
Decision Rule: Reject H0 if p-value < 0.05, otherwise we fail to reject H0.
( since level of significance is not given, we assume it is 0.05)
Since p-value = 0.0000 < 0.05 level of significance, we reject H0 and hence we conclude that there is evidence to suggest that health and education are related.
Get Answers For Free
Most questions answered within 1 hours.