| twocor {WRS2} | R Documentation |
Confidence intervals for two-sided tests on correlation coefficients.
Description
The twopcor function tests whether the difference between two Pearson correlations is 0. The twocor function performs the same test on a robust correlation coefficient (percentage bend correlation or Winsorized correlation).
Usage
twopcor(x1, y1, x2, y2, nboot = 599, ...)
twocor(x1, y1, x2, y2, corfun = "pbcor", nboot = 599, tr = 0.2, beta = 0.2, ...)
Arguments
x1 |
a numeric vector. |
y1 |
a numeric vector. |
x2 |
a numeric vector. |
y2 |
a numeric vector. |
nboot |
number of bootstrap samples. |
corfun |
Either |
tr |
amount of Winsorization. |
beta |
bending constant. |
... |
currently ignored. |
Details
It is tested whether the first correlation coefficient (based on x1 and y1) equals to the second correlation coefficient (based on x2 and y2). Both approaches return percentile bootstrap CIs.
Value
twopcor and twocor return an object of class "twocor" containing:
r1 |
robust correlation coefficient |
r2 |
value of the test statistic |
ci |
confidence interval |
p.value |
p-value |
call |
function call |
References
Wilcox, R. (2012). Introduction to Robust Estimation and Hypothesis Testing (3rd ed.). Elsevier.
See Also
Examples
ct1 <- subset(hangover, subset = (group == "control" & time == 1))$symptoms
ct2 <- subset(hangover, subset = (group == "control" & time == 2))$symptoms
at1 <- subset(hangover, subset = (group == "alcoholic" & time == 1))$symptoms
at2 <- subset(hangover, subset = (group == "alcoholic" & time == 2))$symptoms
set.seed(111)
twopcor(ct1, ct2, at1, at2)
set.seed(123)
twocor(ct1, ct2, at1, at2, corfun = "pbcor", beta = 0.15)
set.seed(224)
twocor(ct1, ct2, at1, at2, corfun = "wincor", tr = 0.15, nboot = 50)