wrap.chi: Chi-square tests

Description Usage Arguments See Also Examples

View source: R/wrap.chi.R

Description

Performs one-way goodness-of-fit and two-way contingency tests. The function delegates the primary operations to chisq.test.

Usage

1
2
3
4
5
6
wrap.chi(
  dv1,
  iv1 = NULL,
  p = rep(1/nlevels(factor(dv1)), nlevels(factor(dv1))),
  correct = F
)

Arguments

dv1

Column vector containing the categorical dependent variable

iv1

Column vector containing the categorical independent variable (contingency tests, only)

p

A vector of probabilities representing expected cell frequencies (goodness-of-fit tests, only). By default, the function assumes equal expected cell frequencies for all levels of the dependent variable.

correct

A logical argument: If FALSE, the function does not apply Yates's correction for 2×2 contingency tables; if TRUE, the function applies Yates's correction for 2×2 contingency tables.

See Also

chisq.test

Examples

1
2
3
4
5
## One-way goodness-of-fit test
wrap.chi(dv1 = bdata$DV9)

## Two-way contingency test
wrap.chi(dv1 = bdata$DV9, iv1 = bdata$IV2)

michaelkardas/behavioralwrappers documentation built on Jan. 2, 2020, 7:46 a.m.