ggstatsplot (version 0.0.8)

bf_contingency_tab: Bayesian contingency table analysis.

Description

Bayesian contingency table analysis.

Usage

bf_contingency_tab(data, main, condition, sampling.plan = "indepMulti",
  fixed.margin = "rows", prior.concentration = 1, caption = NULL,
  output = "caption", k = 2)

Arguments

data

The data as a data frame (matrix or tables will not be accepted).

main

The variable to use as the rows in the contingency table.

condition

The variable to use as the columns in the contingency table.

sampling.plan

Character describing the sampling plan. Possible options are "indepMulti" (independent multinomial; default), "poisson", "jointMulti" (joint multinomial), "hypergeom" (hypergeometric). For more, see ?BayesFactor::contingencyTableBF().

fixed.margin

For the independent multinomial sampling plan, which margin is fixed ("rows" or "cols"). Defaults to "rows".

prior.concentration

Specifies the prior concentration parameter, set to 1 by default. It indexes the expected deviation from the null hypothesis under the alternative, and corresponds to Gunel and Dickey's (1974) "a" parameter.

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_corr_test, bf_oneway_anova, bf_two_sample_ttest

Examples

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

# to get caption (default)
bf_contingency_tab(
  data = mtcars,
  main = am,
  condition = cyl,
  fixed.margin = "cols"
)

# to see results
bf_contingency_tab(
  data = mtcars,
  main = am,
  condition = cyl,
  sampling.plan = "jointMulti",
  fixed.margin = "rows",
  prior.concentration = 1
)
# }

Run the code above in your browser using DataCamp Workspace