equiv_rs: Test equivalence of two groups'correlations/covariances

Description Usage Arguments Details Value Author(s) Examples

View source: R/equiv_rs.R

Description

Given raw data or known sample correlations, test whether correlation/covariance values are equivalent within a specified interval. The null hypothesis is that the groups are not equivalent in degree of association between two variables.

Usage

1
2
3
4
5
equiv_rs(dat1, dat2, equiv_int, n1 = NULL, n2 = NULL, betas = FALSE,
  alpha = 0.05)

## S3 method for class 'equiv_rs'
print(x, ...)

Arguments

dat1

a matrix or data.frame containing raw data used to compute the first correlation/ covariance. A scalar input may be used as well specifying the sample correlation directly

dat2

a matrix or data.frame containing raw data used to compute the second correlation/ covariance. A scalar input may be used as well specifying the sample correlation directly

equiv_int

equivalence interval

n1

sample size for first covariance set (required when input is a correlation)

n2

sample size for second covariance set (required when input is a correlation)

betas

logical; compare raw beta regression coefficients rather than correlations?

alpha

desired alpha level

x

object of class equiv_rs

...

additional arguments to be passed

Details

Function uses Anderson and Hauck's (1983) equivalence test. Because the p-value derived from the test is only an approximation, the CIs may produce results that fall outside of the equivalence interval at small sample sizes, even with a statistically significant p-value. They therefore provide a measure of precision, but cannot be used as a reject/fail to reject decision regarding the null hypothesis.

Value

returns a list containing the coefficients, the equivalence interval, p-value, and statistical decision

Author(s)

Rob Cribbie cribbie@yorku.ca and Alyssa Counsell counsela@yorku.ca

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
#raw data
set.seed(1234)
dat1 <- cbind(rnorm(100), rnorm(100))
dat2 <- cbind(rnorm(200), rnorm(200))
equiv_rs(dat1, dat2, .2)
equiv_rs(dat1, dat2, .2, betas = TRUE)

par(mfrow=c(1,2))
plot(dat1)
plot(dat2)
par(mfrow=c(1,1))

#correlations input
r1 <- cor(dat1)[2,1]
r2 <- cor(dat2)[2,1]
equiv_rs(r1, r2, .2, n1 = 100, n2 = 200)


## End(Not run)

cribbie/equivalencetests documentation built on May 14, 2019, 11:33 a.m.