Learn R Programming

TH (version 1.0.0)

tq2h: Chi-Square Test of Homogeneity

Description

Compares categorical distributions across groups or populations.

Usage

tq2h(
  dadosX = NULL,
  dadosY = NULL,
  FO = NULL,
  alfa = 0.05,
  Ha = 2,
  r = 0,
  plot = TRUE
)

Value

Invisibly returns an object of classes th_test and htest containing the statistic, degrees of freedom, p-value, critical value, decision, observed frequencies, and expected frequencies. When plot = TRUE, an educational graph is produced as a side effect.

Arguments

dadosX

Vector identifying the groups or populations. Use NULL when a frequency table is supplied.

dadosY

Vector containing the response categories. Use NULL when a frequency table is supplied.

FO

Matrix of observed frequencies.

alfa

Significance level.

Ha

Right-tailed alternative. Use 2 or "greater"; other values are rejected.

r

Retained for backward compatibility. It must be zero; Pearson degrees of freedom are used without adjustment.

plot

Logical. If TRUE (default), draw the educational graph; if FALSE, return the result without plotting.

Author

Willian Silva Barros

Details

The function accepts individual categorical observations or an observed frequency matrix. The standard omnibus chi-square homogeneity test has an upper-tail rejection region.

Main assumptions:

  • independent samples or groups;

  • mutually exclusive categories;

  • adequately large expected frequencies;

See Also

tq2a(), tq2i()

Examples

Run this code
FO <- matrix(c(30, 15, 5, 10, 25, 15, 20, 20, 10), nrow = 3, byrow = TRUE)
tq2h(NULL, NULL, FO = FO, alfa = 0.05, Ha = 2, r = 0, plot = FALSE)

Run the code above in your browser using DataLab