pbcor: Robust correlation coefficients.

View source: R/pbcor.R

pbcorR Documentation

Robust correlation coefficients.

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

pbcor(x, y = NULL, beta = 0.2, ci = FALSE, nboot = 500, alpha = 0.05, ...)
pball(x, beta = 0.2, ...)
wincor(x, y = NULL, tr = 0.2, ci = FALSE, nboot = 500, alpha = 0.05, ...)
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.

ci

whether boostrap CI should be computed or not.

nboot

number of bootstrap samples for CI computation.

alpha

alpha level for CI computation.

...

currently ignored.

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

cor_ci

bootstrap confidence interval

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.

See Also

twocor

Examples

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, ci = TRUE)

wincor(x1, x2)
wincor(x1, x2, tr = 0.1, ci = TRUE)

require(reshape)
hanglong <- subset(hangover, subset = group == "control")
hangwide <- cast(hanglong, id ~ time, value = "symptoms")[,-1]

pball(hangwide)
winall(hangwide)

WRS2 documentation built on March 19, 2024, 3:08 a.m.

Related to pbcor in WRS2...