partial.r: Find the partial correlations for a set (x) of variables with...

Description Usage Arguments Details Value Author(s) References See Also Examples


A straightforward application of matrix algebra to remove the effect of the variables in the y set from the x set. Input may be either a data matrix or a correlation matrix. Variables in x and y are specified by location.


partial.r(m, x, y)



A data or correlation matrix


The variable numbers associated with the X set.


The variable numbers associated with the Y set


It is sometimes convenient to partial the effect of a number of variables (e.g., sex, age, education) out of the correlations of another set of variables. This could be done laboriously by finding the residuals of various multiple correlations, and then correlating these residuals. The matrix algebra alternative is to do it directly. To find the confidence intervals and "significance" of the correlations, use the corr.p function with n = n - s where s is the numer of covariates.


The matrix of partial correlations.


William Revelle


Revelle, W. (in prep) An introduction to psychometric theory with applications in R. To be published by Springer. (working draft available at

See Also

mat.regress for a similar application for regression


jen <- make.hierarchical()    #make up a correlation matrix 
par.r <- partial.r(jen,c(1,3,5),c(2,4))
cp <- corr.p(par.r,n=98)  #assumes the jen data based upon n =100.
print(cp,short=FALSE)  #show the confidence intervals as well

Example output

     V1   V2   V3   V4   V5
V1 1.00 0.56 0.48 0.40 0.35
V2 0.56 1.00 0.42 0.35 0.30
V3 0.48 0.42 1.00 0.30 0.26
V4 0.40 0.35 0.30 1.00 0.42
V5 0.35 0.30 0.26 0.42 1.00
Call:corr.p(r = par.r, n = 98)
Correlation matrix 
partial correlations 
     V1   V3   V5
V1 1.00 0.29 0.14
V3 0.29 1.00 0.10
V5 0.14 0.10 1.00
Sample Size 
[1] 98
Probability values (Entries above the diagonal are adjusted for multiple tests.) 
partial correlations 
     V1   V3   V5
V1 0.00 0.01 0.31
V3 0.00 0.00 0.34
V5 0.16 0.34 0.00

 To see confidence intervals of the correlations, print with the short=FALSE option

 Confidence intervals based upon normal theory.  To get bootstrapped values, try
      lower    r upper    p
V1-V3  0.10 0.29  0.46 0.00
V1-V5 -0.06 0.14  0.33 0.16
V3-V5 -0.10 0.10  0.29 0.34

psych documentation built on May 29, 2017, 8:25 p.m.