compare_dependent_rs: Compare dependent correlations

View source: R/compare_dependent_rs.R

compare_dependent_rsR Documentation

Compare dependent correlations

Description

Compares whether two dependent correlations from the same sample are significantly different each other.

Usage

compare_dependent_rs(
  data = NULL,
  var_1_name = NULL,
  var_2_name = NULL,
  var_3_name = NULL,
  one_tailed = FALSE,
  round_r = 3,
  round_p = 3,
  round_t = 2,
  print_summary = TRUE,
  return_dt = FALSE
)

Arguments

data

a data object (a data frame or a data.table)

var_1_name

name of the variable whose correlations with two other variables will be compared.

var_2_name

name of the first of the two variables whose correlations with var_1_name will be compared.

var_3_name

name of the second of the two variables whose correlations with var_1_name will be compared.

one_tailed

logical. Should the p value based on a one-tailed t-test? (default = FALSE)

round_r

number of decimal places to which to round correlation coefficients (default = 2)

round_p

number of decimal places to which to round p-values (default = 3)

round_t

number of decimal places to which to round the t-statistic (default = 2)

print_summary

logical. Should the summary be printed? (default = TRUE)

return_dt

logical. Should the function return a summary table as an output, as opposed to returning the output through the "invisible" function? (default = FALSE)

Details

Suppose that Variables A, B, and C are measured from a group of subjects. This function tests whether A is related to B differently than to C. Put differently, this function tests H0: r(A, B) = r(A, C)

For more information on formulas used in this function, please refer to Steiger (1980) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/0033-2909.87.2.245")} and Chen & Popovich (2002) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.4135/9781412983808")}

Value

the output will be a summary of the test comparing two dependent correlations

Examples

compare_dependent_rs(
data = mtcars, var_1_name = "mpg", var_2_name = "hp", var_3_name = "wt")

kim documentation built on Oct. 9, 2023, 5:08 p.m.