Chi square test of independence using R

Data


Teacher evaluation

Result
Very negative
Negative
Neutral
Positive
Very positive
Total
Fail
10
11
5
8
8
42
Success
6
8
6
15
25
60
Total
16
19
11
23
33
102



Η0: Success in exams and teacher evaluation are independent.

Η1: not Η0.



Chi square test of independence


1. Insert data
the.table = matrix(c(10, 11, 5, 8, 8, 6, 8, 6, 15, 25), 2, 5, byrow=TRUE) rownames(the.table) = c('Fail', 'Success')
colnames(the.table) = c('Very negative', 'Negative', 'Neutral', 'Positive', 'Very positive')

2. Apply test

my.test = chisq.test(the.table)
print(my.test)


3. Understand the significant result
print(round(my.test$residuals, 1))

The above example is contained in the paragraph 3.3 of the book "Στατιστική ανάλυση με τη γλώσσα R" (in Greek, ISBN: 978-960-93-9445-1) published in Thessaloniki, 2017.

Comments