ggstatsplot (version 0.0.7)

bf_two_sample_ttest: Bayesian two-samples t-test.

Description

Bayesian two-samples t-test.

Usage

bf_two_sample_ttest(data, x, y, paired = FALSE, bf.prior = 0.707,
  caption = NULL, output = "caption", k = 2)

Arguments

data

Dataframe from which variables specified are preferentially to be taken.

x

The grouping variable.

y

The response - a vector of length the number of rows of x.

paired

if TRUE, observations are paired

bf.prior

A number between 0.5 and 2 (default 0.707), the prior width to use in calculating Bayes factors.

caption

The text for the plot caption.

output

Can either be "caption" (which will contain text for evidence in favor of null) or "results" (which will return the dataframe with results).

k

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

See Also

bf_contingency_tab, bf_corr_test, bf_oneway_anova

Examples

Run this code
# NOT RUN {
# for reproducibility
set.seed(123)

# to get caption (default)
bf_two_sample_ttest(
  data = mtcars,
  x = am,
  y = wt,
  paired = FALSE,
  bf.prior = 0.880
)

# to see results
bf_two_sample_ttest(
  data = mtcars,
  x = am,
  y = wt,
  paired = FALSE,
  output = "results"
)

# for paired sample test
bf_two_sample_ttest(
  data = dplyr::filter(
    ggstatsplot::intent_morality,
    condition %in% c("accidental", "attempted"),
    harm == "Poisoning"
  ),
  x = condition,
  y = rating,
  paired = TRUE,
  output = "results"
)
# }

Run the code above in your browser using DataLab