# pbcor: Robust correlation coefficients. In WRS2: A Collection of Robust Statistical Methods

## Description

The pbcor function computes the percentage bend correlation coefficient, wincor the Winsorized correlation, pball the percentage bend correlation matrix, winall the Winsorized correlation matrix.

## Usage

 1 2 3 4 pbcor(x, y = NULL, beta = 0.2) pball(x, beta = 0.2) wincor(x, y = NULL, tr = 0.2) winall(x, tr = 0.2)

## Arguments

 x a numeric vector, a matrix or a data frame. y a second numeric vector (for correlation functions). beta bending constant. tr amount of Winsorization.

## Details

It tested is whether the correlation coefficient equals 0 (null hypothesis) or not. Missing values are deleted pairwise. The tests are sensitive to heteroscedasticity. The test statistic H in pball tests the hypothesis that all correlations are equal to zero.

## Value

pbcor and wincor return an object of class "pbcor" containing:

 cor robust correlation coefficient test value of the test statistic p.value p-value n number of effective observations call function call

pball and winall return an object of class "pball" containing:

 pbcorm robust correlation matrix p.values p-values H H-statistic H.p.value p-value H-statistic cov variance-covariance matrix

## References

Wilcox, R. (2012). Introduction to Robust Estimation and Hypothesis Testing (3rd ed.). Elsevier.

## Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 x1 <- subset(hangover, subset = (group == "control" & time == 1))\$symptoms x2 <- subset(hangover, subset = (group == "control" & time == 2))\$symptoms pbcor(x1, x2) pbcor(x1, x2, beta = 0.1) wincor(x1, x2) wincor(x1, x2, tr = 0.1) require(reshape) hanglong <- subset(hangover, subset = group == "control") hangwide <- cast(hanglong, id ~ time, value = "symptoms")[,-1] pball(hangwide) winall(hangwide)

### Example output

Call:
pbcor(x = x1, y = x2)

Robust correlation coefficient: 0.3746
Test statistic: 1.7139
p-value: 0.10371

Call:
pbcor(x = x1, y = x2, beta = 0.1)

Robust correlation coefficient: 0.7966
Test statistic: 5.5909
p-value: 3e-05

Call:
wincor(x = x1, y = x2)

Robust correlation coefficient: 0.2651
Test statistic: 1.1665
p-value: 0.27046

Call:
wincor(x = x1, y = x2, tr = 0.1)

Robust correlation coefficient: 0.7804
Test statistic: 5.2947
p-value: 0.00011

Call:
pball(x = hangwide)

Robust correlation matrix:
1      2      3
1 1.0000 0.3746 0.5493
2 0.3746 1.0000 0.7636
3 0.5493 0.7636 1.0000

p-values:
1       2       3
1      NA 0.10371 0.01212
2 0.10371      NA 0.00009
3 0.01212 0.00009      NA

Test statistic H: 3.063125e+266, p-value = 0

Call:
winall(x = hangwide)

Robust correlation matrix:
1      2      3
1 1.0000 0.2651 0.4875
2 0.2651 1.0000 0.6791
3 0.4875 0.6791 1.0000

p-values:
1       2       3
1      NA 0.27046 0.03935
2 0.27046      NA 0.00284
3 0.03935 0.00284      NA

WRS2 documentation built on May 2, 2019, 4:46 p.m.