View source: R/wrapper_table.R
| rtmb_table | R Documentation |
'rtmb_table' performs a chi-squared test of independence between two categorical variables. It provides both classic (frequentist) Pearson chi-squared tests and Bayesian multinomial-style models.
rtmb_table(
x,
y = NULL,
data = NULL,
correct = TRUE,
prior = prior_flat(),
fixed = NULL,
WAIC = FALSE,
...
)
x |
Variable name, formula, table, or matrix. |
y |
Variable name (optional if x is a formula). |
data |
A data frame. |
correct |
Logical; if TRUE, apply Yates' continuity correction for 2x2 classic analyses. |
prior |
Prior specification (Bayesian mode). Use 'prior_flat()' for a uniform Dirichlet prior or 'prior_normal(dirichlet_alpha = ...)' to set the Dirichlet concentration. Default is 'prior_flat()'. |
fixed |
Optional named list of fixed values for specific parameters. |
WAIC |
Logical; if TRUE, add pointwise 'log_lik' to the generate block for WAIC. |
... |
Reserved; unused arguments are rejected. |
An 'RTMB_Model' object.
# Classic chi-squared test
data(debate, package = "BayesRTMB")
rtmb_table(skill, cond, data = debate)$classic()
rtmb_table(table(debate$skill, debate$cond))$classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.