chisq.residuals: Return the chi-squared residuals of a two-way frequency...

chisq.residualsR Documentation

Return the chi-squared residuals of a two-way frequency table.

Description

Return the raw, standardized or Pearson's residuals (the default) of a chi-squared test on a two-way frequency table.

Usage

chisq.residuals(tab, digits = 2, std = FALSE, raw = FALSE)

Arguments

tab

frequency table

digits

number of digits to display

std

if TRUE, returns the standardized residuals. Otherwise, returns the Pearson residuals. Incompatible with raw.

raw

if TRUE, returns the raw (observed - expected) residuals. Otherwise, returns the Pearson residuals. Incompatible with std.

Details

This function is just a wrapper around the chisq.test base R function. See this function's help page for details on the computation.

See Also

chisq.test

Examples

## Sample table
data(Titanic)
tab <- apply(Titanic, c(1,4), sum)
## Pearson residuals
chisq.residuals(tab)
## Standardized residuals
chisq.residuals(tab, std = TRUE)
## Raw residuals
chisq.residuals(tab, raw = TRUE)

juba/questionr documentation built on Feb. 4, 2023, 11:45 p.m.