exact.nnct | R Documentation |

An object of class `"htest"`

performing exact version of Pearson's chi-square test on nearest neighbor contingency
tables (NNCTs) for the RL or CSR independence for 2 classes.
Pearson's *χ^2* test is based on the test statistic
*\mathcal X^2=∑_{j=1}^2∑_{i=1}^2 (N_{ij}-μ_{ij})^2/μ_{ij}*,
which has *χ^2_1* distribution in the limit provided
that the contingency table is constructed under the independence null hypothesis.
The exact version of Pearson's test uses the exact distribution of *\mathcal X^2* rather than large sample
*χ^2* approximation.
That is, for the one-sided alternative, we calculate
the *p*-values as in the function `exact.pval1s`

;
and for the two-sided alternative, we calculate
the *p*-values as in the function `exact.pval2s`

with double argument determining
the type of the correction.

This test would be equivalent to Fisher's exact test `fisher.test`

if the odds ratio=1
(which can not be specified in the current version), and the odds ratio for the RL or CSR independence null
hypothesis is *θ_0=(n_1-1)(n_2-1)/(n_1 n_2)* which is used in the function and
the *p*-value and confidence interval computations are are adapted from `fisher.test`

.

See \insertCiteceyhan:SWJ-spat-sym2014;textualnnspat for more details.

exact.nnct( ct, alternative = "two.sided", conf.level = 0.95, pval.type = "inc", double = FALSE )

`ct` |
A |

`alternative` |
Type of the alternative hypothesis in the test, one of |

`conf.level` |
Level of the upper and lower confidence limits, default is |

`pval.type` |
The type of the |

`double` |
A logical argument (default is |

A `list`

with the elements

`statistic` |
The test statistic, it is |

`p.value` |
The |

`conf.int` |
Confidence interval for the odds ratio in the |

`estimate` |
Estimate, i.e., the observed odds ratio the |

`null.value` |
Hypothesized null value for the odds ratio in the |

`alternative` |
Type of the alternative hypothesis in the test, one of |

`method` |
Description of the hypothesis test |

`data.name` |
Name of the contingency table, |

Elvan Ceyhan

`fisher.test`

, `exact.pval1s`

, and `exact.pval2s`

n<-20 Y<-matrix(runif(3*n),ncol=3) ipd<-ipd.mat(Y) cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10)) ct<-nnct(ipd,cls) ct exact.nnct(ct) fisher.test(ct) exact.nnct(ct,alt="g") fisher.test(ct,alt="g") exact.nnct(ct,alt="l",pval.type = "mid") ############# ct<-matrix(sample(10:20,9),ncol=3) fisher.test(ct) #here exact.nnct(ct) gives error message, since number of classes > 2

nnspat documentation built on Aug. 30, 2022, 9:06 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.