exact.pval2s {nnspat} | R Documentation |
p
-value correction to the two-sided version of exact NNCT test
Description
In using Fisher's exact test on the 2 \times 2
nearest neighbor contingency tables (NNCTs) a correction may be needed
for the p
-value. For the one-sided alternatives, the probabilities of
more extreme tables are summed up, including or excluding the
probability of the table itself (or some middle way).
There is additional complexity in p
-values for the two-sided alternatives.
A recommended method is adding up probabilities of the same
size and smaller than the probability associated with the current table.
Alternatively, one can double the one-sided p
-value (see (Agresti (1992)).
Let the probability of the contingency table itself be p_t=f(n_{11}|n_1,n_2,c_1;\theta_0)
where \theta_0=(n_1-1)(n_2-1)/(n_1 n_2)
which is the odds ratio
under RL or CSR independence and
f
is the probability mass function of the hypergeometric distribution.
**Type (I):** For double the one-sided p
-value, we propose the following four variants:
[(i)] twice the minimum of
p_{inc}
for the one-sided tests, which is table-inclusive version for this type of two-sided test, and denoted asp^I_{inc}
,[(ii)] twice the minimum of
p_{inc}
minus twice the table probabilityp_t
, which is table-exclusive version of this type of two-sided test, and denoted asp^I_{exc}
,[(iii)] table-exclusive version of this type of two-sided test plus
p_t
, which is mid-p
-value for this test, and denoted asp^I_{midd}
,[(iv)]Tocher corrected version (see
tocher.cor
for details).
**Type (II):** For summing the p
-values of more extreme —than that of the table— cases
in both directions, the following variants are obtained.
The p
-value is p=\sum_S f(t|n_1,n_2,c_1;\theta=1)
with
[(i)]
S=\{t:\,f(t|n_1,n_2,c_1;\theta=1) \leq p_t\}
, which is called table-inclusive version,p^{II}_{inc}
,[(ii)] the probability of the observed table is included twice, once for each side; that is
p=p^{II}_{inc}+p_t
, which is called twice-table-inclusive version,p^{II}_{tinc}
,[(iii)] table-inclusive minus
p_t
, which is referred as table-exclusive version,p^{II}_{exc}
,[(iv)] table-exclusive plus one-half the
p_t
, which is called mid-p
version,p^{II}_{mid}
and,[(v)]Tocher corrected version,
p^{II}_{Toc}
, is obtained as before.
See (Ceyhan (2010)) for more details.
Usage
exact.pval2s(ptable, pval, type = "inc", double = FALSE)
Arguments
ptable |
Probability of the observed |
pval |
Table inclusive |
type |
The type of the |
double |
A logical argument (default is |
Value
A modified p
-value based on the correction specified in type
.
Author(s)
Elvan Ceyhan
References
Agresti A (1992).
“A Survey of Exact Inference for Contingency Tables.”
Statistical Science, 7(1), 131-153.
Ceyhan E (2010).
“Exact Inference for Testing Spatial Patterns by Nearest Neighbor Contingency Tables.”
Journal of Probability and Statistical Science, 8(1), 45-68.
See Also
Examples
ct<-matrix(sample(20:40,4),ncol=2)
ptab<-prob.nnct(ct)
pv<-.23
exact.pval2s(ptab,pv)
exact.pval2s(ptab,pv,type="exc")
exact.pval2s(ptab,pv,type="mid")