Skip to contents

[Stable]

A function to compare correlations between independent studies. This function is intended to be used to compare the compatibility of original studies with replication studies (lower p-values indicating lower compatibility).

Usage

compare_cor(
  r1,
  df1,
  r2,
  df2,
  method = c("fisher", "kraatz"),
  alternative = c("two.sided", "less", "greater", "equivalence", "minimal.effect"),
  null = 0
)

Arguments

r1

Correlation from study 1.

df1

Degrees of freedom from study 1 (if a simple correlation the df is N-2).

r2

Correlation from study 2.

df2

Degrees of freedom from study 2 (if a simple correlation the df is N-2).

method

Method for determining differences:

  • "fisher": uses Fisher's z transformation (default)

  • "kraatz": uses the Kraatz method

alternative

A character string specifying the alternative hypothesis:

  • "two.sided": difference is not equal to null (default)

  • "greater": difference is greater than null

  • "less": difference is less than null

  • "equivalence": difference is within the equivalence bounds (TOST)

  • "minimal.effect": difference is outside the equivalence bounds (TOST)

You can specify just the initial letter.

null

A number or vector indicating the null hypothesis value(s):

  • For standard tests: a single value representing the null difference (default = 0)

  • For equivalence/minimal effect tests: either a single value (symmetric bounds ±value will be created) or a vector of two values representing the lower and upper bounds

Value

A list with class "htest" containing the following components:

  • statistic: z-score with name "z"

  • p.value: numeric scalar containing the p-value for the test under the null hypothesis

  • estimate: difference in correlation coefficients between studies

  • null.value: the specified hypothesized value(s) for the null hypothesis

  • alternative: character string indicating the alternative hypothesis

  • method: description of the method used for comparison

  • data.name: "Summary Statistics" to denote summary statistics were utilized

  • cor: list containing the correlation coefficients used in the comparison

  • call: the matched call

Details

This function tests for differences between correlation coefficients from independent studies. It is particularly useful for:

  • Comparing an original study with its replication

  • Meta-analytic comparisons between studies

  • Testing if correlations from different samples are equivalent

The function offers two methods for comparing correlations:

  1. Fisher's z transformation (default): Transforms correlations to stabilize variance

  2. Kraatz method: Uses a direct approach that may be more appropriate for larger correlations

The function supports both standard hypothesis testing and equivalence/minimal effect testing:

  • For standard tests (two.sided, less, greater), the function tests whether the difference between correlations differs from the null value (typically 0).

  • For equivalence testing ("equivalence"), it determines whether the difference falls within the specified bounds, which can be set asymmetrically.

  • For minimal effect testing ("minimal.effect"), it determines whether the difference falls outside the specified bounds.

When performing equivalence or minimal effect testing:

  • If a single value is provided for null, symmetric bounds ±value will be used

  • If two values are provided for null, they will be used as the lower and upper bounds

References

Counsell, A., & Cribbie, R. A. (2015). Equivalence tests for comparing correlation and regression coefficients. The British journal of mathematical and statistical psychology, 68(2), 292-309. https://doi.org/10.1111/bmsp.12045

Anderson, S., & Hauck, W. W. (1983). A new procedure for testing equivalence in comparative bioavailability and other clinical trials. Communications in Statistics-Theory and Methods, 12(23), 2663-2692.

See also

Other compare studies: boot_compare_cor(), boot_compare_smd(), compare_smd()

Examples

# Example 1: Comparing two correlations (standard test)
compare_cor(r1 = 0.45, df1 = 48, r2 = 0.25, df2 = 58,
            method = "fisher", alternative = "two.sided")
#> 
#> 	Difference between two independent correlations (Fisher's z transform)
#> 
#> data:  Summary Statistics
#> z = 1.1637, p-value = 0.2445
#> alternative hypothesis: true difference between correlations is not equal to 0
#> sample estimates:
#> difference between correlations 
#>                             0.2 
#> 

# Example 2: Testing for equivalence between correlations
# Testing if the difference between correlations is within ±0.15
compare_cor(r1 = 0.42, df1 = 38, r2 = 0.38, df2 = 42,
            method = "fisher", alternative = "equivalence", null = 0.15)
#> 
#> 	Difference between two independent correlations (Fisher's z transform)
#> 
#> data:  Summary Statistics
#> z = -0.10351, p-value = 0.324
#> alternative hypothesis: equivalence
#> null values:
#> difference between correlations difference between correlations 
#>                            0.15                           -0.15 
#> sample estimates:
#> difference between correlations 
#>                            0.04 
#> 

# Example 3: Testing for minimal effects using Kraatz method
# Testing if the difference between correlations is outside ±0.2
compare_cor(r1 = 0.53, df1 = 28, r2 = 0.22, df2 = 32,
            method = "kraatz", alternative = "minimal.effect", null = 0.2)
#> 
#> 	Difference between two independent correlations (Kraatz)
#> 
#> data:  Summary Statistics
#> z = 0.11, p-value = 0.3055
#> alternative hypothesis: minimal.effect
#> null values:
#> difference between correlations difference between correlations 
#>                             0.2                            -0.2 
#> sample estimates:
#> difference between correlations 
#>                            0.31 
#> 

# Example 4: One-sided test (are correlations different in a specific direction?)
compare_cor(r1 = 0.65, df1 = 48, r2 = 0.45, df2 = 52,
            method = "fisher", alternative = "greater")
#> 
#> 	Difference between two independent correlations (Fisher's z transform)
#> 
#> data:  Summary Statistics
#> z = 1.4372, p-value = 0.07533
#> alternative hypothesis: true difference between correlations is greater than 0
#> sample estimates:
#> difference between correlations 
#>                             0.2 
#> 

# Example 5: Using asymmetric bounds for equivalence testing
compare_cor(r1 = 0.35, df1 = 48, r2 = 0.25, df2 = 52,
            method = "fisher", alternative = "equivalence", null = c(-0.05, 0.2))
#> 
#> 	Difference between two independent correlations (Fisher's z transform)
#> 
#> data:  Summary Statistics
#> z = -0.092702, p-value = 0.3233
#> alternative hypothesis: equivalence
#> null values:
#> difference between correlations difference between correlations 
#>                           -0.05                            0.20 
#> sample estimates:
#> difference between correlations 
#>                             0.1 
#>