| p_2r | R Documentation |
Function utilizes cocor to perform correlation
comparison for independent, overlapping, and non-overlapping correlation designs.
Type type of correlation design is inferred based on which correlations are
specified.
p_2r(
n,
r.ab,
r.ab2 = NULL,
r.ac,
r.bc,
r.ad,
r.bd,
r.cd,
n2_n1 = 1,
two.tailed = TRUE,
test = NULL,
gen_fun = gen_2r,
return_analysis = FALSE,
...
)
gen_2r(n, R, ...)
n |
sample size |
r.ab |
correlation between variable A and B (for independent groups, this is for sample 1) |
r.ab2 |
(for independent group test only) correlation between variable A and B in sample 2 |
r.ac |
(for overlap/non-overlap) correlation between A and C. This is the correlation
used in the overlapping hypothesis test, comparing this input to |
r.bc |
(for overlap/non-overlap only) correlation between B and C. |
r.ad |
(for non-overlap only) correlation between A and D |
r.bd |
(for non-overlap only) correlation between B and D |
r.cd |
(for non-overlap only) correlation between C and D. This is the correlation
used in the non-overlapping hypothesis test, comparing this input to |
n2_n1 |
sample size ratio. Only used for independent group test |
two.tailed |
logical; use two-tailed test? |
test |
hypothesis testing method to use. Defaults to |
gen_fun |
function used to generate the required discrete data.
Object returned must be a |
return_analysis |
logical; return the analysis object for further extraction and customization? |
... |
additional arguments to be passed to |
R |
a correlation matrix constructed from the inputs
to |
For independent group tests, only r.ab and r.ab2 need to be specified,
where the null hypothesis pertains to H_0: r_{ab}=r_{ab2}.
For overlapping correlation tests, r.ab, r.ac, and r.bc
need to be specified, where the null hypothesis pertains to H_0: r_{ab}=r_{ac}.
For non-overlapping correlation tests, all correlations expect for r.ab2 must be
specified, where the null hypothesis pertains to H_0: r_{ab}=r_{cd}.
a single p-value
Phil Chalmers rphilip.chalmers@gmail.com
# independent (same x-y pairing across groups)
p_2r(100, r.ab=.5, r.ab2=.6)
# return cocor object for further analysis
p_2r(100, r.ab=.5, r.ab2=.6, return_analysis = TRUE)
# estimate empirical power
p_2r(n=100, r.ab=.5, r.ab2=.6) |> Spower()
# estimate n required to reach 80% power
p_2r(n=NA, r.ab=.5, r.ab2=.6) |>
Spower(power=.80, interval=c(100, 5000))
# overlap (same y, different xs)
# H0: r.ab = r.bc
p_2r(100, r.ab=.5, r.ac=.3, r.bc=.2)
# nonoverlap (different ys, different xs)
# H0: r.ab = r.cd
p_2r(100, r.ab=.5, r.ac=.3, r.bc=.2, r.ad=.2, r.bd=.4, r.cd=.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.