[ top | up ]
Chi-Square Test
Syntax
chisquare.test(x, y=NULL, correct=T,
p=rep(1/length(x),length(x)))
Description
This function performs a chisquare test on the
contingency table in the object x
and
returns the results of the test.
If x
is a vector or a matrix with one row or column
and y
has no argument then the table is assumed to be
one-dimensional, and the chisquare test for a specific set of
population probabilities is performed.
These are in the vector p
, or, if p
is missing,
are assumed to be equal.
If x
is a matrix with two or more rows and
two or more columns or x
and y
are vectors or
factors specifying a two-way contingency table with two or
more rows and two or more columns then a chisquare test
for independence or equal group probabilities is
performed.
If correct=TRUE
then Yates' continuity correction is
applied to 2 by 2 tables.
Values
The function prints out the result of the test and returns a
list containing the following elements:
chi
|
the matrix containing the components of chi-square.
|
E
|
the matrix containing the expected values.
|