
Making expression for correlation analysis
expr_corr_test(
data,
x,
y,
nboot = 100,
beta = 0.1,
type = "pearson",
bf.prior = 0.707,
conf.level = 0.95,
conf.type = "norm",
k = 2,
stat.title = NULL,
messages = TRUE,
...
)
A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.
The column in data
containing the explanatory variable to be
plotted on the x
-axis. Can be entered either as a character string (e.g.,
"x"
) or as a bare expression (e.g, x
).
The column in data
containing the response (outcome) variable to
be plotted on the y
-axis. Can be entered either as a character string
(e.g., "y"
) or as a bare expression (e.g, y
).
Number of bootstrap samples for computing confidence interval
for the effect size (Default: 100
).
bending constant (Default: 0.1
). For more, see ?WRS2::pbcor
.
Type of association between paired samples required
(""parametric"
: Pearson's product moment correlation coefficient" or
""nonparametric"
: Spearman's rho" or ""robust"
: percentage bend
correlation coefficient" or ""bayes"
: Bayes Factor for Pearson's r").
Corresponding abbreviations are also accepted: "p"
(for
parametric/pearson's), "np"
(nonparametric/spearman), "r"
(robust),
"bf"
(for bayes factor), resp.
A numeric value between 0.5
and 2
(default 0.707
), the
prior width to use in calculating Bayes Factors.
Scalar between 0 and 1. If unspecified, the defaults return
95%
lower and upper confidence intervals (0.95
).
A vector of character strings representing the type of
intervals required. The value should be any subset of the values "norm"
,
"basic"
, "perc"
, "bca"
. For more, see ?boot::boot.ci
.
Number of digits after decimal point (should be an integer)
(Default: k = 2
).
A character describing the test being run, which will be
added as a prefix in the subtitle. The default is NULL
. An example of a
stat.title
argument will be something like "Student's t-test: "
.
Decides whether messages references, notes, and warnings are
to be displayed (Default: TRUE
).
Currently ignored.
Expression containing results from correlation test with confidence intervals for the correlation coefficient estimate.
For more details, see- https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html
# NOT RUN {
# for reproducibility
set.seed(123)
# without changing defaults
statsExpressions::expr_corr_test(
data = ggplot2::midwest,
x = area,
y = percblack,
type = "parametric"
)
# changing defaults
statsExpressions::expr_corr_test(
data = ggplot2::midwest,
x = area,
y = percblack,
nboot = 25,
beta = 0.2,
type = "robust",
k = 1
)
# }
Run the code above in your browser using DataLab