Learn R Programming

wPerm (version 1.0.1)

perm.hom.test: Permutation Homogeneity Test

Description

Performs a permutation (randomization) test for homogeneity of one variable on two or more populations, using chi-square as the test statistic.

Usage

perm.hom.test(x, type = c("cont", "flat", "raw"),
              variable = NULL, R = 9999)

Arguments

x
a data frame (see details below).
type
a character string indicating the type of data frame; must be one of "cont" (default), "flat", or "raw".
variable
an optional character string that gives the name of the variable whose distributions are to be compared.
R
number of replications (default = 9999).

Value

  • A list with class "perm.cs.hom" containing the following components:
  • Perm.valuesthe values of chi-square obtained from the permutations.
  • Headerthe main title for the output.
  • Variablethe name of the variable whose distributions are to be compared or NULL.
  • Statisticthe statistic used for the permutation test; here, always chi.square.
  • Observedthe value of the chi-square statistic for the observed data.
  • nthe (total) sample size.
  • Nullthe null hypothesis; here, always homogeneous.
  • Alternativethe alternative hypothesis; here, always nonhomogeneous.
  • P.valuethe P-value or a statement like P < 0.001.
  • p.valuethe P-value.

concept

  • permutation tests
  • randomization tests
  • homogeneity test
  • distributions comparison

Details

The null hypothesis is that the populations are homogeneous with respect to the variable under consideration. The alternative hypothesis is that the populations are nonhomogeneous with respect to the variable under consideration. Types of data frames permitted: cont: In this type of data frame, the first variable gives either the possible values of the variable under consideration or the populations. The remaining variables give the observed frequencies. flat: This type of data frame consists of three variables. The first two variables give the pairs of possible values of the variable under consideration and the populations; the third variable gives the frequencies of the pairs. raw: This type of data frame consists of two variables, which give the raw data of the variable-values and populations.

Examples

Run this code
# Self-concept for independent random samples of sighted and blind
# Indian adolescents.
data("self")
str(self)
self
# Note that self is in the form of a contingency table ("cont").

# Permutation homogeneity test to decide whether a difference exists in
# self-concept distributions between sighted and blind Indian adolescents,
# using 999 replications.
perm.hom.test(self, "cont", "Self-concept", 999)
# Or, equivalently, since "cont" is the default "type":
perm.hom.test(self, variable = "Self-concept", R = 999)

Run the code above in your browser using DataLab