# bf_contingency_tab

##### Bayesian contingency table analysis.

Bayesian contingency table analysis.

##### Usage

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

##### Arguments

- data
A dataframe (or a tibble) from which variables specified are to be taken. A 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
Text to display as caption (will be displayed on top of the bayes factor caption/message).

- output
Can either be

`"null"`

(or`"caption"`

or`"H0"`

, which will contain text for evidence in favor of the null hypothesis or H0) or`"alternative"`

(or`"title"`

or`"H1"`

) or`"results"`

, which will return a dataframe with results all the details).- k
Number of digits after decimal point (should be an integer) (Default:

`k = 2`

).- ...
further arguments to be passed to or from methods.

##### See Also

##### Examples

```
# NOT RUN {
# for reproducibility
set.seed(123)
library(ggstatsplot)
# to get caption (in favor of null)
bf_contingency_tab(
data = mtcars,
main = am,
condition = cyl,
fixed.margin = "cols"
)
# to get caption (in favor of alternative)
bf_contingency_tab(
data = mtcars,
main = am,
condition = cyl,
fixed.margin = "rows",
output = "alternative"
)
# to see results
bf_contingency_tab(
data = mtcars,
main = am,
condition = cyl,
sampling.plan = "jointMulti",
fixed.margin = "rows",
prior.concentration = 1
)
# }
```

*Documentation reproduced from package ggstatsplot, version 0.0.11, License: GPL-3 | file LICENSE*