statsExpressions (version 0.3.1)

expr_corr_test: Making expression for correlation analysis

Description

Making expression for correlation analysis

Usage

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,
  ...
)

Arguments

data

A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.

x

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).

y

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).

nboot

Number of bootstrap samples for computing confidence interval for the effect size (Default: 100).

beta

bending constant (Default: 0.1). For more, see ?WRS2::pbcor.

type

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.

bf.prior

A numeric value between 0.5 and 2 (default 0.707), the prior width to use in calculating Bayes Factors.

conf.level

Scalar between 0 and 1. If unspecified, the defaults return 95% lower and upper confidence intervals (0.95).

conf.type

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.

k

Number of digits after decimal point (should be an integer) (Default: k = 2).

stat.title

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: ".

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

...

Currently ignored.

Value

Expression containing results from correlation test with confidence intervals for the correlation coefficient estimate.

References

For more details, see- https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html

Examples

Run this code
# 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