STAT 166: STATISTICS FOR SOCIAL SCIENCES Exercise: Measures of Association
CorrelationAnalysis Aneconomist Aneconomist isinterested isinterested todeterminewheth todeterminewhetherthereis erthereisa a linear ear rela elations onship betwe tween the total tal food food expen xpend ditur tures ( foof ) and total family expenditures (totex ). A random sampleoftenhouseholdswereobservedandthefollowing datawererecorded: foof 38 , 7 7 4 44 , 5 4 8 53 , 1 5 9 95 , 6 2 9 33 , 1 4 1
1.
2.
3.
totex 52 , 6 37 71 , 6 68 1 06 , 4 75 3 01 , 2 05 54 , 4 72
foof 152,606 62,783 16,408 41,131 96,671
totex 21 9 , 63 0 1 4 5 , 07 2 2 9 , 50 0 9 1 , 56 7 2 4 3 , 81 3
Assuming that the data follows bivariate normal distribution, compute and interpret the Pearson’s correlationcoefficient. SupposethedatadonotfollowtheNormaldistribution, compute for the Spearman’s rank-order correlation coefficient. Also, compute for the Kendall Tau rankordercorrelationcoefficient. Test Testwh wheth ether erthe there reis isan an assoc associa iati tion onbet betwe ween enthe the total total food food expen expendit diture ures s ( foof ) ) and and total total family family expend expenditu itures res (totex ) )
STAT 166 Statistics for Social Sciences First Semester 2012-2013 JCYnion
1
STAT 166: STATISTICS FOR SOCIAL SCIENCES Exercise: Measures of Association
1.
EstimatedPearson’scorrelationcoefficient foof
n m e an stdd tddev
totex
10 10 6 3 , 4 8 5 .0 0 1 3 1 , 6 0 3 .9 0 405 053 38.2756 564 4 92929 29..14506
n
∑ X Y i
i
=
1.11948E + 11
i =1
n
∑ X Y − n X Y s xy
=
s
=
xy
ρ ρ ˆ
(
1.11948E + 11 − 10 * 6348 63485. 5.00 00 * 1316 131603 03.9 .9
i i
i =1
=
n − 1
10 − 1
3155445241
=
r
=
s XY s x s y
3155445241 =
40538.27564*92929.14506
=
0.837
using STATA: . pwcorr foof totex, sig | foof totex -------------+-----------------foof | 1.0000 | | totex | 1.0000 | 0.0025
STAT 166 Statistics for Social Sciences First Semester 2012-2013 JCYnion
2
STAT 166: STATISTICS FOR SOCIAL SCIENCES Exercise: Measures of Association
2.
Spearman’srank-ordercorrelationcoefficient foof 38 , 7 74 ( 3 ) 44 , 5 48 ( 5 ) 53 , 1 59 ( 6 ) 95 , 6 29 ( 8 ) 33 , 1 41 ( 2 ) 1 5 2, 6 0 6 ( 1 0 ) 62 , 7 83 ( 7 ) 16 , 4 08 ( 1 ) 41 , 1 31 ( 4 ) 96 , 6 71 ( 9 )
totex 52,637 (2) 71,668 (4) 106,475 (6) 3 01 , 2 05 ( 1 0 ) 54,472 (3) 219,630 (8) 145,072 (7) 29,500 (1) 91,567 (5) 243,813 (9)
d
i
2
d
i
1 1 0 -2 -1 2 0 0 -1 0
1 1 0 4 1 4 0 0 1 0
n
∑ d
2
6 r
s
=
1−
i
i 1 =
3
n
=
− n
1−
6*12 3
10
=
− 10
1 − 0.07273
=
0.9273
usingSTATA: . spearman foof totex Number of obs =
10
Test of Ho: foof and totex are independent Prob > |t| = 0.0001 STAT 166 Statistics for Social Sciences First Semester 2012-2013 JCYnion
3
STAT 166: STATISTICS FOR SOCIAL SCIENCES Exercise: Measures of Association
3.
KendallTaurank-ordercorrelationcoefficient a. ObservetheranksofXandY. Household (X) foof (X) (Y) totex (Y)
1 3 2
2 5 4
3 4 6 8 6 10
5 6 2 10 3 8
7 7 7
8 1 1
9 10 4 9 5 6
b. Arrange ArrangetheranksofX theranksofXinascen inascending dingorderwhile orderwhileranksofY ranksofY followX’sarrangement. Household (X) foof (X) totex (Y) (Y)
8 1 1
5 2 3
1 3 2
9 4 5
2 5 4
3 6 6
7 4 10 6 7 8 9 10 7 10 6 8
c. ObservedthenaturalorderoftheranksofY. Household 8 5 1 9 2 3 1 2 3 4 5 6 (X) foof (X) 1 3 2 5 4 6 (Y) totex (Y) 1 + + + + + 3 + + + 2 + + + 5 + 4 + 6 7 Number of positive signs = 40 10 Number of negative signs = 5 6 S=40–5=35 STAT 166 Statistics for Social Sciences First Semester 2012-2013 JCYnion
7 4 10 6 7 8 9 10 7 10 6 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + - 4
STAT 166: STATISTICS FOR SOCIAL SCIENCES Exercise: Measures of Association
ˆxy
=
T xy
S =
! $ # n & " 2 %
=
2S n (n − 1)
=
2*35 10(10 − 1)
=
0.7778
. ktau foof totex Number of obs Kendall's tau-a Kendall's tau-b Kendall's score SE of score
= = = = =
10 0.7778 35 11.180
Test of Ho: foof and totex are independent Prob > |z| = 0.0024 (continuity corrected)
Pearson Spearman Kendall-Tau Ho : ρ=0 ρs = 0 τ xy=0 Ha: ρ≠0 ρs ≠ 0 τ xy≠0 Test Proc: t-test Spearman Kendall-Tau Test Statistic: r rs s Decision RejectHoifp-value<alpha, Rule: Otherwise,failtorejectHo Computation: 0 .0 0 2 5 0 .0 0 0 1 0.0024 Decision: since p-value < alpha, we reject Ho At alpha = 5%, we have sufficient Conclusion: evidence to say that there is an associationbetween foof and andtotex . . STAT 166 Statistics for Social Sciences First Semester 2012-2013 JCYnion
5