# par.cor: Partial and semipartial correlation In miscor: Miscellaneous Functions for the Correlation Coefficient

## Description

This function computes the partial or semipartial correlation coefficient between two vaiables. In addition, this function can test the partial or semipartial correlation coefficient for H0: ρ .p = ρ0, so that any value for ρ0 can be specified.

## Usage

 ```1 2 3``` ```par.cor(x = NULL, y = NULL, p.xy = NULL, p.x = NULL, p.y = NULL, sig = FALSE, rho0 = 0, alternative = c("two.sided", "less", "greater"), reduced = FALSE, conf.level = 0.95, digits = 3, output = TRUE) ```

## Arguments

 `x` a numeric vector. `y` a numeric vector. `p.xy` a numeric vector or data.frame, varialbe(s) residualized from x and y. `p.x` a numeric vector or data.frame, varialbe(s) residualized only from x. `p.y` a numeric vector or data.frame, varialbe(s) residualized only from y. `sig` logical: if `TRUE`, statistical significance test is conducted. `rho0` a number indicating ρ0, the value under the null hypothesis. `alternative` a character string describing the alternative hypothesis, must be one of `"two.sided"` (default), `"greater"` or `"less"`. `reduced` logical: if `TRUE`, compuatation is based on the reduced formula. `conf.level` confidence level of the interval. `digits` integer indicating the number of decimal places to be displayed. `output` logical: if `TRUE`, output is shown.

## Details

Partial correlation is the correlation of `x` and `y` while statistically controlling for third variables specified in the argument `p.xy`. These variables are residualized from `x` and `y` using (multiple) regression models. Semipartial correlation is the correlation of `x` and `y` while statistically controlling for third variables only for `x` (specified in the argument `p.x`) or `y` (specified in the argument `p.y`). These variables are residualized from `x` or `y` using a (multiple) regression model.

## Value

Returns an object of class `par.cor` with following entries:

 `call` function call `dat` list with data for x.resid (x residualized), y.resid (y residualized), x, y, p.xy, p.y, and p.x `spec` specification of function argument method `res` list with results, i.e., t or z (test statistic), df (degree of freedom) pval (significance value), r.p (partial or semipartial correlation coefficient), n (sample size), lower (lower limit of CI), upper (upper limit of CI)

## Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at,

## References

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

`test.cor`, `conf.cor`, `comptest.cor`, `seqtest.cor`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33``` ```dat <- data.frame(x = c(4, 6, 8, 8, 9, 4), y = c(3, 7, 9, 8, 9, 3), z = c(1, 3, 4, 4, 5, 2)) #-------------------------------------- # Partial correlation par.cor(dat\$x, dat\$y, p.xy = dat\$z) #-------------------------------------- # Semipartial correlation # remove z from x par.cor(dat\$x, dat\$y, p.x = dat\$z) #-------------------------------------- # Semipartial correlation # remove z from y par.cor(dat\$x, dat\$y, p.y = dat\$y) #-------------------------------------- # Partial correlation: Two-sided test # H0: rho.p == 0, H1: rho.p != 0 par.cor(dat\$x, dat\$y, p.xy = dat\$z, sig = TRUE) #-------------------------------------- # Partial correlation: One-sided test # H0: rho.p <= 0.2, H1: rho.p > 0.2 par.cor(dat\$x, dat\$y, p.xy = dat\$z, sig = TRUE, rho0 = 0.4, alternative = "less") ```

### Example output

```|---------------------------------------------------------|
| miscor 0.1-1 (2017-04-02)                               |
| Miscellaneous Functions for the Correlation Coefficient |
|---------------------------------------------------------|
[1] 0.6631337
[1] 0.2213242
[1] -0.1541175

Statistical test for the partial correlation coefficient

H0: rho.p == 0  versus  H1: rho.p != 0

t = 1.772, df = 4, p-value = 0.1511

Sample estimate r.p:      0.663
Two-sided 95% CI: [-0.321, 0.959]

Statistical test for the partial correlation coefficient

H0: rho.p >= 0.4  versus  H1: rho.p < 0.4

z = 0.580, p-value = 1.0000

Sample estimate r.p:      0.663
One-sided 95% CI: [-1.000, 0.941]
```

miscor documentation built on May 1, 2019, 10:14 p.m.