r.test function - RDocumentation (2024)

Description

Tests the significance of a single correlation, the difference between two independent correlations, the difference between two dependent correlations sharing one variable (Williams's Test), or the difference between two dependent correlations with different variables (Steiger Tests).

Usage

r.test(n, r12, r34 = NULL, r23 = NULL, r13 = NULL, r14 = NULL, r24 = NULL, n2 = NULL,pooled=TRUE, twotailed = TRUE)

Value

test

Label of test done

z

z value for tests 2 or 4

t

t value for tests 1 and 3

p

probability value of z or t

Arguments

n

Sample size of first group

r12

Correlation to be tested

r34

Test if this correlation is different from r12, if r23 is specified, but r13 is not, then r34 becomes r13

r23

if ra = r(12) and rb = r(13) then test for differences of dependent correlations given r23

r13

implies ra =r(12) and rb =r(34) test for difference of dependent correlations

r14

implies ra =r(12) and rb =r(34)

r24

ra =r(12) and rb =r(34)

n2

n2 is specified in the case of two independent correlations. n2 defaults to n if if not specified

pooled

use pooled estimates of correlations

twotailed

should a twotailed or one tailed test be used

Author

William Revelle

Details

Depending upon the input, one of four different tests of correlations is done.1) For a sample size n, find the t value for a single correlation where $$t = \frac{r * \sqrt(n-2)}{\sqrt(1-r^2)}$$ and

$$se = \sqrt{\frac{1-r^2}{n-2}}) $$.

2) For sample sizes of n and n2 (n2 = n if not specified) find the z of the difference between the z transformed correlations divided by the standard error of the difference of two z scores: $$z = \frac{z_1 - z_2}{\sqrt{\frac{1}{(n_1 - 3) + (n_2 - 3)}}}$$.

3) For sample size n, and correlations r12, r13 and r23 test for the difference of two dependent correlations (r12 vs r13).

4) For sample size n, test for the difference between two dependent correlations involving different variables.

Consider the correlations from Steiger (1980), Table 1: Because these all from the same subjects, any tests must be of dependent correlations. For dependent correlations, it is necessary to specify at least 3 correlations (e.g., r12, r13, r23)

VariableM1F1V1M2F2V2M1 1.00
F1.101.00V1.40.501.00M2
.70.05.501.00F2.05.70.50
.501.00V2.45.50.80.50.60

For clarity, correlations may be specified by value. If specified by location and if doing the test of dependent correlations, if three correlations are specified, they are assumed to be in the order r12, r13, r23.

Consider the examples from Steiger:

Case A: where Masculinity at time 1 (M1) correlates with Verbal Ability .5 (r12), femininity at time 1 (F1) correlates with Verbal ability r13 =.4, and M1 correlates with F1 (r23= .1). Then, given the correlations: r12 = .4, r13 = .5, and r23 = .1, t = -.89 for n =103, i.e.,r.test(n=103, r12=.4, r13=.5,r23=.1)

Case B: Test whether correlation between two variables (e.g., F and V) is the same over time (e.g. F1V1 = F2V2)

r.test(n = 103, r12 = 0.5, r34 = 0.6, r23 = 0.5, r13 = 0.7, r14 = 0.5, r24 = 0.8)

References

Cohen, J. and Cohen, P. and West, S.G. and Aiken, L.S. (2003) Applied multiple regression/correlation analysis for the behavioral sciences, L.Erlbaum Associates, Mahwah, N.J.

Olkin, I. and Finn, J. D. (1995). Correlations redux. Psychological Bulletin, 118(1):155-164.

Steiger, J.H. (1980), Tests for comparing elements of a correlation matrix, Psychological Bulletin, 87, 245-251.

Williams, E.J. (1959) Regression analysis. Wiley, New York, 1959.

See Also

See also corTest which tests all the elements of a correlation matrix, and cortest.mat to compare two matrices of correlations. r.test extends the tests in paired.r,r.con

Examples

Run this code

n <- 30 r <- seq(0,.9,.1) rc <- matrix(r.con(r,n),ncol=2) test <- r.test(n,r)r.rc <- data.frame(r=r,z=fisherz(r),lower=rc[,1],upper=rc[,2],t=test$t,p=test$p) round(r.rc,2) r.test(50,r)r.test(30,.4,.6) #test the difference between two independent correlationsr.test(103,.4,.5,.1) #Steiger case A of dependent correlations r.test(n=103, r12=.4, r13=.5,r23=.1) #for complicated tests, it is probably better to specify correlations by namer.test(n=103,r12=.5,r34=.6,r13=.7,r23=.5,r14=.5,r24=.8) #steiger Case B ##By default, the precision of p values is 2 decimals#Consider three different precisions shown by varying the requested number of digitsr12 = 0.693458895410494 r23 = 0.988475791500198 r13 = 0.695966022434845 print(r.test(n = 5105 , r12 = r12 , r23 = r23 , r13 = r13 )) #probability < 0.1print(r.test(n = 5105 , r12 = r12, r23 = r23 , r13 = r13 ),digits=4) #p < 0.1001print(r.test(n = 5105 , r12 = r12, r23 = r23 , r13 = r13 ),digits=8) #p< <0.1000759 #an example of how to compare the elements of two matrices R1 <- lowerCor(bfi[1:200,1:5]) #find one set of CorrelationsR2 <- lowerCor(bfi[201:400,1:5]) #and now another set sampled #from the same populationtest <- r.test(n=200, r12 = R1, r34 = R2)round(lowerUpper(R1,R2,diff=TRUE),digits=2) #show the differences between correlations#lowerMat(test$p) #show the p values of the difference between the two matricesadjusted <- p.adjust(test$p[upper.tri(test$p)])both <- test$p both[upper.tri(both)] <- adjustedround(both,digits=2) #The lower off diagonal are the raw ps, the upper the adjusted ps

Run the code above in your browser using DataLab

r.test function - RDocumentation (2024)

References

Top Articles
Leatherworking - Dragonflight Alpha | World of Warcraft GamePlay Guides
Bradshaw & Range Funeral Home | Waukegan, Illinois
Record-breaking crowd lifts Seattle Sounders to CCL glory on "special" night | MLSSoccer.com
Aflac on LinkedIn: Aflac Supplemental Insurance | 22 comments
Caremount Medical Flu Shots 2022
The KT extinction
Lvc Final Exam Schedule
Woman Jumps Off Mount Hope Bridge 2022
Sigma Aldrich Calculator
Sirius Mlb Baseball
Best Conjuration Spell In Skyrim
William Spencer Funeral Home Portland Indiana
Old Navy Student Discount Unidays
Netflix Phone Number: Live Human Help - Netflix - Claimyr
Rivers Edge Online Login Bonus
Black Friday 2024, Black Friday 2025 and further
Pear Shaped Rocsi
Dmv Rocklin Wait Times
Ksat Doppler Radar
Labcorp Locations Near Me
Regal Stone Pokemon Gaia
The Tragic Death Of Nikki Catsouras: The Story Behind The Viral Photos
Jennifer Beals Bikini
Bay State Neurology
Thothub Alinity
Todos los dress codes para hombre que existen, explicados
Perry County Mugshots Busted
Wayne State Academica Login
Po Box 182223 Chattanooga Tn 37422 7223
Gmail Psu
Strange World Showtimes Near Twin County Cinema
Circuit Court Evanston Wy
Any Ups Stores Open Today
Indiefoxx's biography: why has the streamer been banned so often?
Tcu Jaggaer
Guardians Of The Galaxy Holiday Special Putlocker
Whose Address Is Po Box 9040 Coppell Tx 75019
Lacy Aaron Schmidt Where Is He Now
Kenji Lentil Soup
G122 Pink Pill
Beaufort Mugfaces Last 72 Hours
John Deere Z355R Parts Diagram
NO CLUE: deutsche Übersetzung von NCT 127
Katie Hamden Of
Collision Masters Fairbanks Alaska
Katopunk Pegging
R Toronto Blue Jays
Buhsd Studentvue
Skip The Games Mil
Pizza Mia Belvidere Nj Menu
Unblocked Games 67 Ez
Perolamartinezts
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5829

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.