Description Usage Arguments Value Author(s) References See Also Examples
Computes a contingency table for each pair of rows of a matrix, and stores all contigency table in a matrix.
1 2 |
data |
a numeric matrix consisting of integers between 1 and |
computeExp |
should the numbers of observations expected under the null hypothesis that
the respective two variables are independent also be computed? Required
when |
justDiag |
should only the diagonal elements of the contingency tables,
i.e.\ n.ii, i = 1, …, |
check |
should |
n.cat |
integer specifying the maximum number of levels a variable can take. If |
A list consisting of two matrices each consisting of m * (m - 1) / 2 rows and
n.cat
^2 columns, where m is the number of rows of data
.
One of these matrices
called mat.obs
contains in each row the values of the contingency table for
a particular pair of rows of data
, where the contigency table of the variables represented
by the ith and jth row of data
is shown in the
j + m * (i - 1) - i * (i - 1) / 2 row of mat.obs
.
The other matrix called mat.exp
consists of
the corresponding numbers of observations expected under the null hypothesis that
the respective two variables are independent.
Holger Schwender, holger.schwender@udo.edu
Schwender, H.\ (2007). A Note on the Simultaneous Computation of Thousands of Pearson's ChiSquare-Statistics. Technical Report, SFB 475, Deparment of Statistics, University of Dortmund.
computeContClass
, rowChisqStats
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## Not run:
# Generate an example data set consisting of 5 rows (variables)
# and 200 columns (observations) by randomly drawing integers
# between 1 and 3.
mat <- matrix(sample(3, 1000, TRUE), 5)
# Generate the matrix containing the contingency tables for each
# pair of rows of mat.
out <- computeContCells(mat)
# out contains both the observed numbers of observations
# summarized by contingency tables
out$mat.obs
# and the number of observations expected under the null hypothesis
# of independence.
out$mat.exp
# If, e.g., only the observed number of observations having the same
# value is of interest, call
computeContCells(mat, computeExp = FALSE, justDiag = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.