Professional Documents
Culture Documents
Stat - 111 - Lecture - 4 - 2
Stat - 111 - Lecture - 4 - 2
PROBABILITY
LECTURE 4: DESCRIPTIVE STATISTICS FOR BIVARIATE DATA
1 Introduction
Learning Objectives and Learning Outcomes
Bivariate Data Analysis
3 Contingency Coefficients
Phi Contingency Coefficient (PCC)
Cramer’s V Contingency Coefficient (CVCC)
Tschuprow’s T Contingency Coefficient (TTCC)
Pearson’s Contingency Coefficient
Kappa Contingency Coefficient
Learning Objectives
To introduce the student to descriptive measures that can be used to
analyze bivariate data.
Learning Outcomes
By the end of the lecture, the student should be able to:
1 Explain what bivariate data is and give examples
2 Explain the use of Contingency Tables and Contingency Coefficient
3 Compute and interpret appropriate Contingency Coefficients for
different data
4 Explain the difference between Covariance and Correlation
5 Compute and interpret appropriate Correlation Coefficients for
different data
Contingency Table
A Contingency Table is a table used to describe bivariate qualitative
(categorical)data sets, showing the distribution of one variable in the rows
and the other variable in the column.
Contingency tables are named based on the size of the table. That
is, Contingency tables are named based on the number of rows and
columns the table has.
. If X and Y are two categorical data sets with m and n distinct
categories respectively, then the contingency table for both variables
will be an mxn contingency table as shown on the table below:
Y = y1 Y = y2 Y = y3 ... Y = yn Total
X = x1 O11 O12 O13 ... O1n R1
X = x2 O21 O22 O23 ... O2n R2
X = x3 O31 O32 O33 ... O3n R3
... ... ... ... ... ... ...
X = xm Om1 Om2 Om3 ... Omn Rm
Total C1 C2 C3 ... Cn N
Contingency Coefficients
A Contingency Coefficient is a measure of the extent of association or
dependence between two categorical variables or attributes.
(Oij − Eij )2
P
2
χ = (2)
Eij
and Eij is calculated as
Ri ∗ Cj
Eij = (3)
N
Y = y1 Y = y2 Total
X = x1 O11 O12 R1
X = x2 O21 O22 R2
Total C1 C2 N
Y = y1 Y = y2 Total
X = x1 A B R1
X = x2 C D R2
Total C1 C2 N
AD − BC
ϕ= p (5)
(R1 )(R2 )(C1 )(C2 )
Example 1
The Dean of Students randomly sampled 70 students in the University of
Ghana and asked then whether they are fresh students or continue
students as well as whether they are residential or non-residential students
as shown in the table below. Calculate the phi coefficient.
The variables here are the Level of Study (i.e. fresh student or
continue students) and Residential Status (Resident or
Non-Resident). Hence i = 1, 2 and j = 1, 2 . Total number of
observations is 70 (i.e. N = 70 )
Step 1: Calculate χ2 since the phi coefficient is dependent on it.
X (Oij − Eij )2
χ2 = (6)
Eij
R 1 ∗ C2 27 ∗ 19 513
E12 = = = = 7.3286 (9)
N 70 70
R2 ∗ C1 43 ∗ 51 2193
E21 = = = = 31.3286 (10)
N 70 70
R 2 ∗ C2 43 ∗ 19 817
E22 = = = = 11.6714 (11)
N 70 70
Step 2: Calculate ϕ. r
χ2
ϕ= (12)
N
r
0.5382
ϕ= = 0.0877 (13)
70
(21)(13) − (6)(30)
ϕ= p (15)
(27)(43)(51)(19)
273 − 180
ϕ= p (16)
(1125009
93
ϕ= = 0.0876 (17)
1060.6644
(21)(13) − (6)(30)
ϕ= p (19)
(27)(43)(51)(19)
273 − 180
ϕ= p (20)
(1125009
93
ϕ= = 0.0876 (21)
1060.6644
Example 2
A researcher is interested in finding out if the choice of university is
dependent on the area of origin of students. The data the researcher
obtained from students is summarized below. Calculate Cramer’s V
coefficient for the data.
The variables here are area of origin (i.e. northern, middle belt or
southern) and Choice of University (UG, KNUST, UCC or others).
Hence i = 1, 2, 3 and j = 1, 2, 3, 4 and
t = min(r − 1, c − 1) = min(3 − 1, 4 − 1) = 2.Total number of
observations is 272 (i.e. N = 272)
Step 1: Calculate χ2 since the Cramer’s V coefficient is dependent on
it.
X (Oij − Eij )2
χ2 = (24)
Eij
and Eij is calculated as
Ri ∗ Cj
Eij = (25)
N
R1 ∗ C1 90 ∗ 104 9360
E11 = = = = 34.4118 (26)
N 272 272
Solution to Example 3
The Tschuprow’s T Contingency Coefficient using the data in Example 2
is .....
Solution to Example 3
The Pearson’s Contingency Coefficient using the data in Example 2 is .....
Inter-rater reliability occurs when data raters (or collectors) give the
same score to the same data item.
K can also be calculated when one rater rates two trials on each
sample.
K varies from 0 (representing agreement equivalent to chance) to 1
(representing a perfect agreement).
K is defined as
Po − Pe 1 − Po
K= =1− (31)
1 − Pe 1 − Pe
where Po is the relative observed agreement among the raters; Pe is
the hypothetical probability of chance (expected) agreement between
the raters.
(a + d)
Po = (32)
N
The expected agreementPe is calculated as:
n1 m1 n2 m2
Pe = [( ) ∗ ( )] + [( ) ∗ ( )] (33)
N N n N
Example 5
A lecturer wanted to measure the effectiveness of his mode of delivery
during lectures. He picked two students from his class and asked them to
evaluate the usefulness of a series of 100 lectures delivered by him.
Student 1 and Student 2 agree that the lectures are useful 15% of the
time and not useful 70% of the time. The data is presented in the table
below. Calculate the degree of agreement between the two students using
the Kappa Contingency Coefficient, K .
Student1
Yes No Total
Student2 Yes 15 5 20
Student2 No 10 70 80
Total 25 75 100
(15 + 70)
Po = = 0.85 (34)
100
Example 6
The table below shows the results of a study assessing the prevalence of
depression among 200 patients treated in a primary care setting using two
methods to determine the presence of depression; one based on
information provided by the individual (i.e., proband) and the other based
on information provided by another informant (e.g., the subject’s family
member or close friend) about the proband. Calculate the degree of
agreement between the two approaches using the Kappa Contingency
Coefficient, K .
Informant
Depressed NotDepressed Total
Proband Depressed 65 50 115
Proband NotDepressed 19 66 85
Total 84 116 200
Types of Relationships
There are different ways in which two variables may be related:
1 absence of relationship
2 negative linear relationship
3 positive linear relationship
4 nonlinear relationship
Example 7
The data below shows the number of years spent in college (X ) and the
subsequent yearly income (Y ), in thousands of Ghana cedis for Six people.
Can one conclude that the number of years spent in college affects yearly
income?
Person number of years spent in college (X) yearly income (Y)
1 0 15
2 1 15
3 3 30
4 4 25
5 4 30
6 6 35
Person X Y X2 Y2 XY
1 0 15 0 225 0
2 1 15 1 225 15
3 3 30 9 400 60
4 4 25 16 625 100
5 4 30 16 900 120
6 6 35 36 1225 210
Total 18 140 78 3600 505
Now if the data was from the population the population covariance
between the two random variables X and Y would be:
(6)(505) − (18)(140) 3030 − 2520 510
Cov (X , Y ) = = = = 14.1667
6(6) 36 36
(42)
and if the data was from the sample and we were estimating the
population, then the sample covariance between two random
variables X and Y would be:
(6)(505) − (18)(140) 3030 − 2520 510
Cov (X , Y ) = = = = 17 (43)
6(5) 30 30
Example 8
The data below shows the number of years spent in college (X ) and the
subsequent yearly income (Y ), in thousands of Ghana cedis for Six people.
Calculate the Pearson’s Product Moment Correlation Coefficient between
the two variables and comment on it.
Person number of years spent in college (X) yearly income (Y)
1 0 15
2 1 15
3 3 30
4 4 25
5 4 30
6 6 35
Person X Y X2 Y2 XY
1 0 15 0 225 0
2 1 15 1 225 15
3 3 30 9 400 60
4 4 25 16 625 100
5 4 30 16 900 120
6 6 35 36 1225 210
Total 18 140 78 3600 505
(6)(505) − (18)(140)
RX ,Y = p (47)
[(6)(78) − (18)2 ][(6)(3600) − (140)2 ]
3030 − 2520 510
RX ,Y = p =p (48)
[468 − 324][21600 − 19600] [144][2000]
510 510
RX ,Y = √ = = 0.9503 (49)
288000 536.6563
510 510
RX ,Y = √ = = 0.9503 (50)
288000 536.6563
Comment
There is a strong positive relationship between number of years spent in
college and the yearly income of a person. In other words, the more years
you spent in college, the higher your yearly income.
If your data does not meet the assumptions required to use the
Pearson’s Product Moment Correlation Coefficient (PMCC), then use
Spearman’s Rank Correlation Coefficient.
The Spearman’s Rank Correlation (Rs ), sometimes referred to as
Spearman’s rho, after the Greek letter rho (ρ), is a non-parametric
measure of correlation which make use of the ranks of the paired
data. The Spearman’s Rank correlation measures the strength and
direction of association between two ranked variables (i.e. the
Spearman’s correlation between two variables is equal to the Pearson
correlation between the rank values of those two variables).
While Pearson’s correlation assesses linear relationships, Spearman’s
correlation assesses monotonic relationships (whether linear or not).
6 ni=1 di2
P
Rs = 1 − (52)
n3 − n
If the sequence of ranks were identical for the two variables, we would
say that there was a perfect positive correlation, and Rs = 1 .
If the magnitudes of the ranks for one variable vary inversely with the
magnitudes of the ranks of the other variable, we have a perfect
negative correlation, where Rs = −1.
6 ni=1 di2
P
Rs = 1 − (53)
n3 − n
(6)(8)
Rs = 1 − (54)
93 − 9
48
Rs = 1 − (55)
720
Rs = 1 − 0.0667 = 0.9333 (56)
Comment: There is a strong positive relationship between the length
and weight of snakes.
Ties occurs if two or more values of a particular variable are the same
value.
When that happens,the ranks of the tied values is set equal to the
mean of the ranks they would have received if there were no
repetition in the ordered data set.
NB: if there are ties in both variables, the ties are dealt with
separately or independently.
Example 10: Given the variable X with values 10, 8, 7, 8,6, 9, 6.
Then 1st rank is assigned to 10 because it is the biggest value, then
2nd to 9.
Now there is a repetition of 8 twice. Since both values are same, the
same rank will be assigned which would be average of the ranks
that we would have assigned if there were no repetition.
No. Xi Yi
1 10 6
2 15 25
3 14 12
4 25 18
5 14 25
6 14 40
7 20 10
8 22 7
And since there are ties in both variables, then Spearman’s Rank
Correlation Coefficient between the variables (X ) and (Y ) will be:
6( ni=1 di2 − m
P P Pr
i=1 (tx )i − i=1 (ty )i )
Rs = 1 − p (60)
[(n − n) − 2 i=1 (tx )i ][(n − n) − 2 m
3
Pm 3
P
i=1 (ty )i ]
Now
m P 3 P 3
X (ti − ti ) 3 − 3)
(tx )i = = =2 (61)
12 12
i=1
and
r P 3 P 3
X (ti − ti ) (2 − 2)
(ty )i = = (62)
12 12
i=1
6(81)
Rs = 1 − p (64)
[504 − 4][504 − 1]
486 486
Rs = 1 − p =1− √ (65)
[500][503] 251500
486
Rs = 1 − = 1 − 0.9690 = 0.031 (66)
501.4978
Example 12: The data below shows the ranking of 6 judges for two
variables ”Eloquence (X)” and ”Intelligence(Y)” for a beauty pageant.
Calculate the Kendall’s rank correlation coefficient between the judges
ranking.
Judge A B C D E F
X 4 6 2 3 1 5
Y 3 6 1 4 2 5
Pair Sign Pair Sign Pair Sign Pair Sign Pair Sign
AB + BC + CD + DE + EF +
AC + BD + CE - DF
AD - BE + CF +
AE + BF +
AF +
From the table, the number of ”+” signs is 13 . Hence the number of
concordant pairs C = 13 . Also the number of ”-” signs is 2 , hence
the number of discordant pairs is D = 2.
Judge E C D A F B
X 1 2 3 4 5 6
Y 2 1 4 3 5 6
The S = C − D for the table above is
S = C −D = (4−1)+(4−0)+(2−1)+(2−0)+(1−0) = 13−2 = 11
2(13 − 2) 2(11)
rk = = (74)
6(6 − 1) 6(5)
11
rk = = 0.733 (75)
15
Comment: There is a strong positive relationship between the judges
ranking.
(C − D)
rk = τβ = p p (76)
(N − T ) (N − U)
where
n(n − 1)
N= (77)
2
Pm
ti (ti − 1)
T = i=1 (78)
2
Pr
ti (ti − 1)
U = i=1 (79)
2
Example 13: Calculate the Kendall‘s tau correlation coefficient for the
data below.
Xi 68 70 71 71 72 77 77 86 87 88 91 91
Yi 64 65 77 80 72 65 76 88 72 81 90 96
Xi 68 70 71 71 72 77 77 86 87 88 91 91
Yi 64 65 77 80 72 65 76 88 72 81 90 96