report.chitest: Report the results of chi-square test

View source: R/report.chitest.R

report.chitestR Documentation

Report the results of chi-square test

Description

This function conducts Chi-square tests for independence between pairs of categorical variables. It provides the option to use Monte Carlo simulations for the p-value computation and to calculate Cramer's V.

Usage

report.chitest(
  varNamesX,
  varNamesY,
  data,
  simulate.p.value = TRUE,
  cramer = FALSE,
  language = "english",
  ...
)

Arguments

varNamesX

A vector of strings representing the names of the X variables in the data frame.

varNamesY

A vector of strings representing the names of the Y variables in the data frame.

data

A data frame or an object of class survey.design from survey package.

simulate.p.value

A logical value indicating whether to compute p-values by Monte Carlo simulation. Default is TRUE.

cramer

A logical value indicating whether to compute Cramer's V for the pairs. Default is FALSE.

language

The language used for displaying the statistics in the frequency table. This parameter accepts two values: english or slovene. Depending on the chosen language, all statistical terms and output will be adjusted accordingly. Default is english.

...

Additional arguments to be passed to the chisq.test function.

Value

A matrix with rows representing each pair of variables, and columns representing: 1) variable pair, 2) Chi-square statistic, 3) p-value (calculated by simulation or classic method, based on 'simulate.p.value'), 4) degrees of freedom (if 'simulate.p.value' is FALSE), 5) Cramer's V (if 'cramer' is TRUE).

Author(s)

Marjan Cugmas

Examples

report.chitest(varNamesX = c("cyl", "vs", "am"),
varNamesY = "gear", data = mtcars, simulate.p.value = TRUE)

handyReport documentation built on Oct. 8, 2024, 3 p.m.