Tesing H 0 : ρ = 0: Comaring A Single Correlaion o Zero February 5, 2018 Conens Tesing H 0 : ρ = 0 Examle 1: The correlaion beween heighs of your arens Examle 2: Drinking and Facebook friends Using R o run a hyohesis es for one correlaion Quesions Answers Tesing H 0 : ρ = 0 In his uorial we ll be esing he null hyohesis ha an observed correlaion is drawn from a oulaion of correlaions ha has a mean of zero (ρ = 0) This urns ou o be a simle -es Here s how o ge o he indeenden means -es in he flow char: START HERE Tes for = 0 Ch 172 1 number of correlaions correlaion (r) measuremen scale frequency number of variables 1 2 es frequency Ch 195 2 2 Tes for 1 = 2 Ch 174 Means 2 es indeendence Ch 199 z-es Ch 131 Yes Do you know? 1 number of means More han 2 number of 2 facors 2-facor ANOVA Ch 21 No 1 one samle -es Ch 1314 2 1-facor ANOVA Ch 20 indeenden measures -es Ch 156 Yes indeenden samles? No deenden measures -es Ch 164 Sir Ronald Fisher figured ou ha you can conver a correlaion value o a -saisic using he Fisher s z ransform : 1
= r 1 r 2 n 2 The degrees of freedom is df = n-2 where n is he number of airs in he correlaion Here s some good news: he book and our Excel sreadshee have a able (Table G) ha rovide he criical values of r so you don even need o calculae Plus I ve given you calculaor on he same Excel age ha gives you a -value for his -es Examle 1: The correlaion beween heighs of your arens Le s es he hyohesis ha eole end o marry eole of similar heighs Secifically, we ll use he survey from our class and es he hyohesis ha he correlaion beween he heighs of mohers and fahers is greaer han zero Le s choose an alha value of 001 For he 144 sudens in our class, he correlaion beween he heighs of mohers and fahers is 041 Here s he scaerlo: 80 n = 144, r = 041 75 fahers heighs (in) 70 65 60 55 52 54 56 58 60 62 64 66 68 70 72 mohers heighs (in) Since we re looking for a osiive correlaion, his will be a 1-ailed es All we need o do is look u he row in Table G for df = 144-2 = 142: 2
α: one ail 005 0025 001 0005 140 0139 0165 0195 0216 141 0138 0164 0194 0215 142 0138 0164 0194 0214 143 0137 0163 0193 0213 144 0137 0163 0192 0213 The criical value of r is 0194 Our observed value of r is 041 is greaer han he criical value of 0194 We herefore rejec H 0 and conclude ha he correlaion beween he heighs of mohers and fahers is significanly greaer han zero We can use he calculaor on he Excel sreadshee for able G o find he -value: r o α df r α (one ail) α (wo ail) 142 041 0 0 53566 α o r df r r cri (one ail) r cri (wo ail) 142 001 01937 0214 cri cri 23529 26109 To sae our conclusions using APA forma, we d sae: The correlaion beween mohers and fahers for sudens in his class heighs is significanly greaer han zero, r(142) = 041, < 00001 Examle 2: Drinking and Facebook friends For he 144 sudens in our class, he correlaion beween he number of of alcoholic drinks and he number of facebook friends is 035 Le s see if his correlaion is significanly differen han zero We ll use α = 005 This will be a 2-ailed es Looking u he row in Table G for df = 144-2 = 142, and he column for α = 005 2 = 0025 (since his is a wo-ailed es): α: one ail 005 0025 001 0005 140 0139 0165 0195 0216 141 0138 0164 0194 0215 142 0138 0164 0194 0214 143 0137 0163 0193 0213 144 0137 0163 0192 0213 3
The criical value of r is 0164 The calculaor in he sreadshee gives he -value of 0 r o α df r α (one ail) α (wo ail) 142 035 0 0 44523 α o r df r r cri (one ail) r cri (wo ail) 142 005 01376 01637 cri cri 16557 19768 Our observed value of r =035 is ouside he range from -0164 o 0164 We herefore rejec H 0 and conclude ha he correlaion beween he of alcoholic drinks and facebook friends is significanly differen han zero To resen our conclusions using APA forma, we d sae: The correlaion beween alcoholic drinks and facebook friends for sudens in his class is significanly differen han zero, r(142) = 035, < 00001 Using R o run a hyohesis es for one correlaion The following R scri covers how o run a es for ρ = 0 using he funcion cores : The R commands shown below can be found here: ComaringOneCorrelaionR # Comaring one correlaion o he null hyohesis ha rho = 0 # # If you have your raw x and y daa, R s funcion cores gives you a -value for esing # he hyohesis ha a correlaion was drawn from a oulaion ha has a correlaion of zero # I akes in he x and y variables along wih alernaive which can be "greaer", "less" # for a one-ailed es or "wosided"for a wo-ailed es Here are he examles from he # comaring_one_correlaion uorial # By defaul, cores convers he correlaion of x and y ino a -saisic and hen comues # a -es # Load in he survey daa survey <-readcsv("h://wwwcourseswashingonedu/sy315/daases/psych315w18surveycsv") # Examle 1: The correlaion beween heighs of your arens x <- survey$mheigh y <- survey$heigh goodvals =!isna(x) &!isna(y) x <- x[goodvals] y <- y[goodvals] # cores runs he -es for you: ou <- cores(x,y,alernaive = "greaer") 4
# esimae is he correlaion ou$esimae cor 04083501 # value is he -value ou$value [1] 1879602e-07 # saisic is he -saisic used in he es: ou$saisic 5330759 # wih degrees of freedom: ou$arameer df 142 # Here s how o dislay your resuls in APA forma: srinf( r(%g) = %42f, = %54f,ou$arameer,ou$esimae,ou$value) [1] "r(142) = 041, = 00000" # This is calculaed direcly from r and df So his should be he same # hing (See he beginning of he comariong_one_correlaion_uorialdf ou$esimae/sqr((1-ou$esimae^2)/(lengh(x)-2)) cor 5330759 # Examle 2: Two ailed es on he correlaion beween drinking and Facebook friends x <- survey$drink y <- survey$friends goodvals =!isna(x) &!isna(y) x <- x[goodvals] y <- y[goodvals] ou <- cores(x,y,alernaive = "wosided") # APA forma: srinf( r(%g) = %42f, = %54f,ou$arameer,ou$esimae,ou$value) [1] "r(150) = 035, = 00000" # If you jus have r and he samle size bu no he raw daa, you can calculae # he -value by running a -es by hand: # The correlaion beween x and y is: r <- cor(x,y) # The degrees of freedom is df <- lengh(x) -2 # The -saisic us comued using he Fisher s z ransform : <- r/sqr((1-r^2)/df) # The -value for a wo-ailed for no equal o 0 should give you he same -value as for cores: 2*(abs(),df,0,lowerail = FALSE) [1] 1237865e-05 5
Quesions I s random quesion ime! Here are 10 racice quesions followed by heir answers Some of hem require you o calculae correlaions from he acual scores For hese, you migh wan o coy he numbers and ase hem ino Excel 1) For some reason you samle 24 living bus riders from a oulaion and measure boh heir jusice and heir waer You calculae ha heir jusice correlaes wih waer wih r = 024 Using an alha value of α = 005, is his observed correlaion significanly greaer han zero? 2) Le s samle 7 orid cows from a oulaion and measure boh heir safey and heir ain hreshold You calculae ha heir safey correlaes wih ain hreshold wih r = 054 Using an alha value of α = 005, is his observed correlaion significanly differen han zero? 3) Your friend ges you o samle 13 uffy beer from a oulaion and measure boh heir rogress and heir hainess You calculae ha heir rogress correlaes wih hainess wih r = -05 Using an alha value of α = 005, is his observed correlaion significanly less han zero? 4) You go ou and samle 14 amygdalas from a oulaion and measure boh heir raffic and heir sofness You calculae ha heir raffic correlaes wih sofness wih r = 0 Using an alha value of α = 005, is his observed correlaion significanly less han zero? 5) You decide o samle 24 fingerrins from a oulaion and measure boh heir hainess and heir recogniion You calculae ha heir hainess correlaes wih recogniion wih r = 019 Using an alha value of α = 001, is his observed correlaion significanly differen han zero? 6) Wihou anyhing beer o do, you samle 6 daughers from a oulaion and measure boh heir cash and heir widh You calculae ha heir cash correlaes wih widh wih r = -075 Using an alha value of α = 001, is his observed correlaion significanly differen han zero? 7) You samle 14 widgis from a oulaion and measure boh heir culure and heir smell You calculae ha heir culure correlaes wih smell wih r = -032 Using an alha value of α = 001, is his observed correlaion significanly less han zero? 8) Le s samle 23 siky brains from a oulaion and measure boh heir imorance and heir cos You calculae ha heir imorance correlaes wih cos wih r = -026 Using an alha value of α = 001, is his observed correlaion significanly less han zero? 9) You go ou and samle 25 baseballs from a oulaion and measure boh heir evil and heir informaion You calculae ha heir evil correlaes wih informaion wih r = 023 Using an alha value of α = 005, is his observed correlaion significanly greaer han zero? 10) Jus for fun, you samle 25 Asian food from a oulaion and measure boh heir homework and heir disance You calculae ha heir homework correlaes wih disance wih r = 014 Using an alha value of α = 001, is his observed correlaion significanly greaer han zero? 6
Answers 1) Correlaion beween jusice and waer of living bus riders r obs = 024 = 11596 cri = 172(df = 22) or r cri = 034 We fail o rejec H 0 The correlaion beween jusice and waer for living bus riders is no significanly greaer han zero, r(22) = 024, = 01293 r <- 024 df <- 24-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] 1159591 <- (,df,0,lowerail=false) [1] 01293231 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(22) = 024, = 01293" 2) Correlaion beween safey and ain hreshold of orid cows r obs = 054 = 14346 cri = ±257(df = 5) or r cri = ±075 We fail o rejec H 0 The correlaion beween safey and ain hreshold for orid cows is no significanly differen han zero, r(5) = 054, = 02109 r <- 054 df <- 7-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] 1434629 <- 2*(abs(),df,0,lowerail = FALSE) [1] 02108582 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(5) = 054, = 02109" 3) Correlaion beween rogress and hainess of uffy beer r obs = 05 = 19149 cri = 180(df = 11) or r cri = 048 7
We rejec H 0 The correlaion beween rogress and hainess for uffy beer is significanly less han zero, r(11) = -05, = 00409 r <- -05 df <- 13-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] -1914854 <- (,df,0,lowerail=true) [1] 004093212 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(11) = -050, = 00409" 4) Correlaion beween raffic and sofness of amygdalas r obs = 0 = 0 cri = 178(df = 12) or r cri = 046 We fail o rejec H 0 The correlaion beween raffic and sofness for amygdalas is no significanly less han zero, r(12) = -0, = 05 r <- -0 df <- 14-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] 0 <- (,df,0,lowerail=true) [1] 05 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(12) = -000, = 05000" 5) Correlaion beween hainess and recogniion of fingerrins r obs = 019 = 09077 cri = ±282(df = 22) or r cri = ±052 We fail o rejec H 0 The correlaion beween hainess and recogniion for fingerrins is no significanly differen han zero, r(22) = 019, = 03739 r <- 019 df <- 24-2 # Fisher s z ransform 8
<- r/sqr((1-r^2)/df) [1] 09077138 <- 2*(abs(),df,0,lowerail = FALSE) [1] 03738656 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(22) = 019, = 03739" 6) Correlaion beween cash and widh of daughers r obs = 075 = 22678 cri = ±460(df = 4) or r cri = ±092 We fail o rejec H 0 The correlaion beween cash and widh for daughers is no significanly differen han zero, r(4) = -075, = 00859 r <- -075 df <- 6-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] -2267787 <- 2*(abs(),df,0,lowerail = FALSE) [1] 00859375 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(4) = -075, = 00859" 7) Correlaion beween culure and smell of widgis r obs = 032 = 117 cri = 268(df = 12) or r cri = 061 We fail o rejec H 0 The correlaion beween culure and smell for widgis is no significanly less han zero, r(12) = -032, = 01324 r <- -032 df <- 14-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] -1170036 <- (,df,0,lowerail=true) [1] 01323501 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) 9
[1] "r(12) = -032, = 01324" 8) Correlaion beween imorance and cos of siky brains r obs = 026 = 12339 cri = 252(df = 21) or r cri = 048 We fail o rejec H 0 The correlaion beween imorance and cos for siky brains is no significanly less han zero, r(21) = -026, = 01154 r <- -026 df <- 23-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] -1233905 <- (,df,0,lowerail=true) [1] 01154349 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(21) = -026, = 01154" 9) Correlaion beween evil and informaion of baseballs r obs = 023 = 11334 cri = 171(df = 23) or r cri = 034 We fail o rejec H 0 The correlaion beween evil and informaion for baseballs is no significanly greaer han zero, r(23) = 023, = 01344 r <- 023 df <- 25-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] 1133428 <- (,df,0,lowerail=false) [1] 01343557 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(23) = 023, = 01344" 10) Correlaion beween homework and disance of Asian food r obs = 014 = 06781 cri = 250(df = 23) or r cri = 046 10
We fail o rejec H 0 The correlaion beween homework and disance for Asian food is no significanly greaer han zero, r(23) = 014, = 02522 r <- 014 df <- 25-2 # Fisher s z ransform <- r/sqr((1-r^2)/df) [1] 06780946 <- (,df,0,lowerail=false) [1] 02522386 # APA forma: srinf( r(%g) = %42f, = %54f,df,r,) [1] "r(23) = 014, = 02522" 11