Description Usage Arguments Details Value Author(s) References See Also Examples
The test detects differential departure from independence via second-order difference in joint distributions underlying two or more contingency tables.
1 2 3 4 | sharma.song.test(
tables, null.table.marginal = c("observed", "uniform"),
compensated = FALSE
)
|
tables |
a list of at least two non-negative matrices or data frames representing contingency tables of the same dimensions. |
null.table.marginal |
a character string to specify marginal distributions of null tables. The options are |
compensated |
a logical value to compensate for the Cochran's condition. It is only used if |
The Sharma-Song test determines whether the patterns underlying multiple input contingency tables are second-order differential. The test statistic measures differential departure form independence. Its null test statistic is proved to asymptotically follow the chi-squared distribution. For full detail of the test, see \insertCiteruby2021/BIOINF-2020-0795DiffXTables.
If null.table.marginal
is set to "observed"
, the null hypothesis uses the observed marginals. The compensated
parameter, if set to TRUE
, adds a small constant to each entry of the tables to address the Cochran's condition that the expected count in any table entry is 5 or less.
If the null.table.marginal
is set to "uniform"
, the null tables are set to have uniform marginals. No longer suffering from the Cochran's condition, it detects second-order differential patterns with additional robustness.
A list with class "htest
" containing the following components:
statistic |
the Sharma-Song chi-squared test statistic. |
parameter |
degrees of freedom of the chi-squared test statistic. |
p.value |
p-value of the Sharma-Song test, computed using the chi-squared distribution. |
Ruby Sharma and Joe Song
cp.chisq.test
, heterogeneity.test
, strength.test
, marginal.change.test
, and
type.analysis
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Two second-order differential tables:
tables <- list(
matrix(c(4,0,0,
0,4,0,
0,0,4), nrow=3),
matrix(c(0,4,4,
4,0,4,
4,4,0), nrow=3)
)
sharma.song.test(tables)
# Three tables differ in the first-order but not second-order:
tables <- list(
matrix(c(2, 4, 6, 8,
3, 6, 9, 12,
4, 8, 12, 16), nrow=4),
matrix(c( 2, 1, 3, 7,
2, 1, 3, 7,
10, 5, 15, 35), nrow=4),
matrix(c(40, 16, 72, 16,
45, 18, 81, 18,
25, 10, 45, 10), nrow=4)
)
sharma.song.test(tables, null.table.marginal = "uniform")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.