wrap.chi: Chi-square tests

View source: R/wrap.chi.R

wrap.chiR Documentation

Chi-square tests

Description

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

Usage

wrap.chi(dv1, iv1 = NULL, p = rep(1/nlevels(dv1), nlevels(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 2x2 contingency tables; if TRUE, the function applies Yates's correction for 2x2 contingency tables.

See Also

chisq.test

Examples

## One-way goodness-of-fit test
wrap.chi(dv1 = bdata$DV2)

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


michaelkardas/bwrappers documentation built on Nov. 13, 2022, 1:14 a.m.