# Nearest Neighbor Methods for Spatial Patterns

## Documentation for package ‘nnspat’ version 0.1.2

- DESCRIPTION file
- Package README

## Help Pages

A B C D E F I K L M N O P Q R S T V W X Z misc

nnspat-package | nnspat: A package for NN Methods and Their Use in Testing Spatial Patterns

## -- A --

aij.mat | Aij matrices for computation of Moments of Cuzick and Edwards T_k Test statistic
aij.nonzero | Aij matrices for computation of Moments of Cuzick and Edwards T_k Test statistic
aij.theta | Closeness or Proximity Matrix for Tango's Spatial Clustering Tests
asycovTkTl | Asymptotic Covariance between T_k and T_l Values
asyvarTk | Asymptotic Variance of Cuzick and Edwards T_k Test statistic

## -- B --

base.class.spec | Base Class-specific Chi-square Tests based on NNCTs
base.class.spec.ct | Base Class-specific Chi-square Tests based on NNCTs
bvnorm.pdf | pdf of the Bivariate Normal Distribution

## -- C --

cell.spec | Cell-specific Z Tests of Segregation for NNCTs
cell.spec.ct | Cell-specific Z Tests of Segregation for NNCTs
cell.spec.ss | Pielou's Cell-specific Segregation Test with Normal Approximation (for Sparse Sampling)
cell.spec.ss.ct | Pielou's Cell-specific Segregation Test with Normal Approximation (for Sparse Sampling)
cellsTij | Entries for the Types I-IV cell-specific tests
ceTk | Cuzick and Edwards T_k Test statistic
ceTkinv | Cuzick and Edwards T_k^{inv} Test statistic
ceTrun | Cuzick and Edwards T_{run} Test statistic
class.spec | Class-specific Chi-square Tests based on NNCTs
class.spec.ct | Class-specific Chi-square Tests based on NNCTs
classirest | Functions for one versus rest type labeling
col.sum | Functions for row and column sums of a matrix
correct.cf1 | Correction Matrices for the Covariance Matrix of NNCT entries
correct.cf2 | Correction Matrices for the Covariance Matrix of NNCT entries
cov.2cells | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
cov.2cols | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
cov.cell.col | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
cov.nnct | Covariance Matrix of the Cell Counts in an NNCT
cov.nnsym | Covariance Matrix of the Differences of the Off-Diagonal Cell Counts in an NNCT
cov.seg.coeff | Covariance Matrix of Segregation Coefficients in a Multi-class Case
cov.tct | Covariance Matrix of the Entries of the Type I-IV TCTs
cov.tct3 | Functions for Covariances of the Entries of the Types I, III and IV TCTs
cov.tctI | Functions for Covariances of the Entries of the Types I, III and IV TCTs
cov.tctIII | Functions for Covariances of the Entries of the Types I, III and IV TCTs
cov.tctIV | Functions for Covariances of the Entries of the Types I, III and IV TCTs
covCiCj | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
covNii | Covariance Matrix of the Self Entries in a Species Correspondence Contingency Table (SCCT)
covNii.ct | Covariance Matrix of the Self Entries in a Species Correspondence Contingency Table (SCCT)
covNijCk | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
covNrow2col | Conversion of the Covariance Matrix of the Row-wise Vectorized Cell Counts to Column-wise Vectorized Cell Counts in an NNCT
covTcomb | Covariance matrix for T_k values in 'Tcomb'
covTkTl | Finite Sample Covariance between T_k and T_l Values

## -- D --

dist.std.data | Interpoint Distance Matrix for Standardized Data
dist2full | Converts a lower triangular distance matrix to a full distance matrix

## -- E --

euc.dist | The Euclidean distance between two vectors, matrices, or data frames
EV.Nii | Expected Values of the Self Entries in a Species Correspondence Contingency Table (SCCT)
EV.nnct | Expected Values of the Cell Counts in NNCT
EV.rct | Expected Values of the Cell Counts in RCT
EV.Tcomb | Expected Value for Cuzick & Edwards T_{comb} Test Statistic
EV.tct | Expected Values of the Types I-IV cell-specific tests
EV.tctI | Expected Values of the Type I cell-specific tests
EV.Tk | Expected Value for Cuzick and Edwards T_k Test statistic
EV.Tkaij | Expected Value for Cuzick and Edwards T_k Test statistic
EV.Tkinv | Expected Value of Cuzick and Edwards T_k^{inv} Test statistic
EV.Trun | Expected Value for Cuzick and Edwards T_{run} Test statistic
EV.Trun.alt | Expected Value for Cuzick and Edwards T_{run} Test statistic
exact.nnct | Exact version of Pearson's chi-square test on NNCTs
exact.pval1s | p-value correction to the one-sided version of exact NNCT test
exact.pval2s | p-value correction to the two-sided version of exact NNCT test

## -- F --

funs.auxcovtct | Auxiliary Functions for Computing Covariances Between Cell Counts in the TCT
funs.base.class.spec | Base Class-specific Chi-square Tests based on NNCTs
funs.cell.spec.ss | Pielou's Cell-specific Segregation Test with Normal Approximation (for Sparse Sampling)
funs.class.spec | Class-specific Chi-square Tests based on NNCTs
funs.covNii | Covariance Matrix of the Self Entries in a Species Correspondence Contingency Table (SCCT)
funs.covtct | Functions for Covariances of the Entries of the Types I, III and IV TCTs
funs.kNNdist | Functions for the k^{th} and 'k' NN distances
funs.kNNdist2cl | Functions for the k^{th} and 'k' NN distances
funs.overall.nnct | Dixon's Overall Test of Segregation for NNCT
funs.overall.seg | Overall Segregation Tests for NNCTs
funs.overall.tct | Types I-IV Overall Tests of Segregation for NNCT
funs.pijPij | The functions for probability of selecting a number of points from respective classes
funs.scct | Species Correspondence Contingency Table (SCCT)
funs.seg.coeff | Pielou's Segregation Coefficients for NNCTs
funs.varNii | Variances of the Self Entries in a Species Correspondence Contingency Table (SCCT)
funs.vartct | Functions for Variances of Cell Counts in the Types I, III and IV TCTs
funsAijmat | Aij matrices for computation of Moments of Cuzick and Edwards T_k Test statistic
funsC_MI_II | Correction Matrices for the Covariance Matrix of NNCT entries
funsExpTk | Expected Value for Cuzick and Edwards T_k Test statistic
funsExpTrun | Expected Value for Cuzick and Edwards T_{run} Test statistic
funsNNclass.spec | NN Class-specific Chi-square Tests based on NNCTs
funsN_I_II | Correction Matrices for the NNCT entries
funsOnevsRest | Functions for one versus rest type labeling
funsPseg.ss | Pielou's Overall Test of Segregation for NNCT (for Sparse Sampling)
funsQandR | Functions for the number of shared NNs, shared NN vector, and the number of reflexive NNs
funsRowColSums | Functions for row and column sums of a matrix
funsVarTk | Variance of Cuzick and Edwards T_k Test statistic
funsVarTrun | Variance of Cuzick and Edwards T_{run} Test statistic
funsW345values | W_k values for Tango's T test statistic
funsXsq.nnref | Reflexivity Test with Chi-square Approximation
funsXsq.nnsym.dx | Dixon's NN Symmetry Test with Chi-square Approximation for multiple classes
funsXsq.nnsym.ss | Pielou's First Type of NN Symmetry Test with Chi-square Approximation for multiple classes (for Sparse Sampling)
funsXsq.seg.coeff | Chi-square Test for Segregation Coefficients
funsXsq.spec.cor | Overall Species Correspondence Test with Chi-square Approximation
funsZcell.nnct | Dixon's Cell-specific Z Tests of Segregation for NNCT
funsZcell.nnct.pval | p-values for Cell-specific Z Test Statistics for NNCT
funsZcell.spec | Cell-specific Z Tests of Segregation for NNCTs
funsZcell.tct | Types I-IV Cell-specific Z Tests of Segregation based on NNCTs
funsZdir.nnct | Directional Segregation Test for Two Classes with Normal Approximation
funsZdir.nnct.ss | Directional Segregation Test for Two Classes with Normal Approximation (for Sparse Sampling)
funsZmixed.nonref | Mixed-Non-Reflexivity Test with Normal Approximation
funsZnnref | Z Tests for NN Reflexivity
funsZnnself | Self-Reflexivity Tests with Normal Approximation
funsZnnself.sum | Cumulative Species Correspondence Test with Normal Approximation
funsZnnsym.dx | Dixon's Pairwise NN Symmetry Test with Normal Approximation
funsZnnsym.ss | Pielou's Pairwise NN Symmetry Test with Normal Approximation (for Sparse Sampling)
funsZnnsym2cl.dx | Dixon's NN Symmetry Test with Normal Approximation for Two Classes
funsZnnsym2cl.ss | Pielou's First Type of NN Symmetry Test with Normal Approximation for Two Classes (for Sparse Sampling)
funsZseg.coeff | Z Tests for Segregation Coefficients
funsZsegind | Z Tests for Segregation Indices
funsZself.ref | Self-Reflexivity Test with Normal Approximation
funsZTkinv | Z-Test for Cuzick and Edwards T_k^{inv} statistic

## -- I --

ind.nnsym | Index Matrix for Computing the Covariance of Dixon's Overall NN Symmetry Test
ind.seg.coeff | Index Matrix for Computing the Covariance of Segregation Coefficients
ipd.mat | Interpoint Distance Matrix
ipd.mat.euc | Euclidean Interpoint Distance Matrix

## -- K --

kNN | Finding the indices of the 'k' NNs of a given point
kNNdist | Functions for the k^{th} and 'k' NN distances
kNNdist2cl | Functions for the k^{th} and 'k' NN distances
kthNNdist | Functions for the k^{th} and 'k' NN distances
kthNNdist2cl | Functions for the k^{th} and 'k' NN distances

## -- L --

lab.onevsrest | Functions for one versus rest type labeling

## -- M --

mat2vec | Conversion of a Matrix to a Vector
matrix.sqrt | Square root of a matrix

## -- N --

Ninv | Vector of Shared NNs and Number of Reflexive NNs
NN | Finding the index of the NN of a given point
NN.class.spec | NN Class-specific Chi-square Tests based on NNCTs
NN.class.spec.ct | NN Class-specific Chi-square Tests based on NNCTs
nnct | Nearest Neighbor Contingency Table (NNCT)
nnct.boot.dis | Bootstrap Nearest Neighbor Contingency Table (NNCT)
nnct.cr1 | Correction Matrices for the NNCT entries
nnct.cr2 | Correction Matrices for the NNCT entries
nnct.sub | Nearest Neighbor Contingency Table (NNCT) with (only) base points restricted to a subsample
NNdist | Distances between subjects and their NNs
NNdist2cl | Distances between subjects from class i and their NNs from class j
nnspat | nnspat: A package for NN Methods and Their Use in Testing Spatial Patterns
NNsub | Finding the index of the NN of a given point among a subset of points
Nt.def | N_t Value (found with the definition formula)
Ntkl | N_{tkl} Value

## -- O --

overall.nnct | Dixon's Overall Test of Segregation for NNCT
overall.nnct.ct | Dixon's Overall Test of Segregation for NNCT
overall.seg | Overall Segregation Tests for NNCTs
overall.seg.ct | Overall Segregation Tests for NNCTs
overall.tct | Types I-IV Overall Tests of Segregation for NNCT
overall.tct.ct | Types I-IV Overall Tests of Segregation for NNCT

## -- P --

P11 | The functions for probability of selecting a number of points from respective classes
p11 | The functions for probability of selecting a number of points from respective classes
P111 | The functions for probability of selecting a number of points from respective classes
p111 | The functions for probability of selecting a number of points from respective classes
P1111 | The functions for probability of selecting a number of points from respective classes
p1111 | The functions for probability of selecting a number of points from respective classes
P1112 | The functions for probability of selecting a number of points from respective classes
p1112 | The functions for probability of selecting a number of points from respective classes
P112 | The functions for probability of selecting a number of points from respective classes
p112 | The functions for probability of selecting a number of points from respective classes
P1122 | The functions for probability of selecting a number of points from respective classes
p1122 | The functions for probability of selecting a number of points from respective classes
P1123 | The functions for probability of selecting a number of points from respective classes
p1123 | The functions for probability of selecting a number of points from respective classes
P12 | The functions for probability of selecting a number of points from respective classes
p12 | The functions for probability of selecting a number of points from respective classes
p122 | The functions for probability of selecting a number of points from respective classes
p1223 | The functions for probability of selecting a number of points from respective classes
P123 | The functions for probability of selecting a number of points from respective classes
p123 | The functions for probability of selecting a number of points from respective classes
P1234 | The functions for probability of selecting a number of points from respective classes
p1234 | The functions for probability of selecting a number of points from respective classes
pairwise.lab | Keeping the pair of the specified labels in the data
pick.min.max | Smallest and Largest Distances in a Distance Matrix
pk | Probability of 'k' items selected from the class with size n_1
plot.Clusters | Plot a 'Clusters' object
plot.SpatPatterns | Plot a 'SpatPatterns' object
print.cellhtest | Print a summary of a 'cellhtest' object
print.Chisqtest | Print a summary of a 'Chisqtest' object
print.classhtest | Print a summary of a 'classhtest' object
print.Clusters | Print a 'Clusters' object
print.refhtest | Print a summary of a 'refhtest' object
print.SpatPatterns | Print a 'SpatPatterns' object
print.summary.Clusters | Print a summary of a 'Clusters' object
print.summary.SpatPatterns | Print a summary of a 'SpatPatterns' object
prob.nnct | Probability of the current nearest neighbor contingency table
Pseg.coeff | Pielou's Segregation Coefficients for NNCTs
Pseg.ss | Pielou's Overall Test of Segregation for NNCT (for Sparse Sampling)
Pseg.ss.ct | Pielou's Overall Test of Segregation for NNCT (for Sparse Sampling)

## -- Q --

QRval | Number of Shared and Reflexive NNs
Qsym.ct | Q-symmetry Contingency Table (QCT)
Qsym.test | Pielou's Second Type of NN Symmetry Test with Chi-square Approximation
Qval | Functions for the number of shared NNs, shared NN vector, and the number of reflexive NNs
Qvec | Functions for the number of shared NNs, shared NN vector, and the number of reflexive NNs

## -- R --

rassoc | Generation of Points Associated with a Given Set of Points
rassocC | Generation of Points Associated in the Type C Sense with a Given Set of Points
rassocG | Generation of Points Associated in the Type G Sense with a Given Set of Points
rassocI | Generation of Points Associated in the Type I Sense with a Given Set of Points
rassocU | Generation of Points Associated in the Type U Sense with a Given Set of Points
rct | Reflexivity Contingency Table (RCT)
rdiag.clust | Generation of Points with Clusters along the First Diagonal
rhor.clust | Generation of Points with Clusters along the Horizontal Axis
rnonRL | Non-Random Labeling of a Given Set of Points
rnonRLI | Type I Non-Random Labeling of a Given Set of Points
rnonRLII | Type II Non-Random Labeling of a Given Set of Points
rnonRLIII | Type III Non-Random Labeling of a Given Set of Points
rnonRLIV | Type IV Non-Random Labeling of a Given Set of Points
row.sum | Functions for row and column sums of a matrix
rrot.clust | Generation of Points with Rotational Clusters
rseg | Generation of Points under Segregation of Two Classes
rself.ref | Generation of Points from Self Correspondence Pattern
runif.circ | Generation of Uniform Points in a Circle
Rval | Functions for the number of shared NNs, shared NN vector, and the number of reflexive NNs

## -- S --

scct | Species Correspondence Contingency Table (SCCT)
scct.ct | Species Correspondence Contingency Table (SCCT)
seg.coeff | Pielou's Segregation Coefficients for NNCTs
seg.ind | Dixon's Segregation Indices for NNCTs
sharedNN | Functions for the number of shared NNs, shared NN vector, and the number of reflexive NNs
sharedNNmc | The Shared NN Vectors for Multiple Classes
SkewTk | Skewness of Cuzick and Edwards T_k Test statistic
summary.Clusters | Return a summary of a 'Clusters' object
summary.SpatPatterns | Return a summary of a 'SpatPatterns' object
swamptrees | Tree Species in a Swamp Forest

## -- T --

Tcomb | Cuzick & Edwards Tcomb Test Statistic
tct | T Contingency Table (TCT)
tocher.cor | Tocher's randomized correction to the exact p-value
Tval | T value in NN structure

## -- V --

var.nnct | Variances of Cell Counts in an NNCT
var.nnsym | Variances of Differences of Off-Diagonal Entries in an NNCT
var.seg.coeff | Variances of Segregation Coefficients in a Multi-class Case
var.tct | Variances of Entries in a TCT
var.tctI | Functions for Variances of Cell Counts in the Types I, III and IV TCTs
var.tctIII | Functions for Variances of Cell Counts in the Types I, III and IV TCTs
var.tctIV | Functions for Variances of Cell Counts in the Types I, III and IV TCTs
varNii | Variances of the Self Entries in a Species Correspondence Contingency Table (SCCT)
varNii.ct | Variances of the Self Entries in a Species Correspondence Contingency Table (SCCT)
varPseg.coeff | Variance of Pielou's Segregation Coefficient for 2 Classes
varTk | Variance of Cuzick and Edwards T_k Test statistic
varTkaij | Variance of Cuzick and Edwards T_k Test statistic
varTkinv.sim | Simulated Variance of Cuzick and Edwards T_k^{inv} Test statistic
varTrun | Variance of Cuzick and Edwards T_{run} Test statistic
varTrun.sim | Variance of Cuzick and Edwards T_{run} Test statistic

## -- W --

W3val | W_k values for Tango's T test statistic
W4val | W_k values for Tango's T test statistic
W5val | W_k values for Tango's T test statistic
Wmat | The incidence matrix 'W' for the NN digraph

## -- X --

Xsq.ceTk | Chi-square Approximation to Cuzick and Edwards T_k Test statistic
Xsq.nnref | Reflexivity Test with Chi-square Approximation
Xsq.nnref.ct | Reflexivity Test with Chi-square Approximation
Xsq.nnsym | Overall NN Symmetry Test with Chi-square Approximation
Xsq.nnsym.dx | Dixon's NN Symmetry Test with Chi-square Approximation for multiple classes
Xsq.nnsym.dx.ct | Dixon's NN Symmetry Test with Chi-square Approximation for multiple classes
Xsq.nnsym.ss | Pielou's First Type of NN Symmetry Test with Chi-square Approximation for multiple classes (for Sparse Sampling)
Xsq.nnsym.ss.ct | Pielou's First Type of NN Symmetry Test with Chi-square Approximation for multiple classes (for Sparse Sampling)
Xsq.seg.coeff | Chi-square Test for Segregation Coefficients
Xsq.seg.coeff.ct | Chi-square Test for Segregation Coefficients
Xsq.spec.cor | Overall Species Correspondence Test with Chi-square Approximation
Xsq.spec.cor.ct | Overall Species Correspondence Test with Chi-square Approximation

## -- Z --

Zcell.nnct | Dixon's Cell-specific Z Tests of Segregation for NNCT
Zcell.nnct.2s | p-values for Cell-specific Z Test Statistics for NNCT
Zcell.nnct.ct | Dixon's Cell-specific Z Tests of Segregation for NNCT
Zcell.nnct.ls | p-values for Cell-specific Z Test Statistics for NNCT
Zcell.nnct.pval | p-values for Cell-specific Z Test Statistics for NNCT
Zcell.nnct.rs | p-values for Cell-specific Z Test Statistics for NNCT
Zcell.tct | Types I-IV Cell-specific Z Tests of Segregation based on NNCTs
Zcell.tct.ct | Types I-IV Cell-specific Z Tests of Segregation based on NNCTs
ZceTk | Z-test for Cuzick and Edwards T_k statistic
Zdir.nnct | Directional Segregation Test for Two Classes with Normal Approximation
Zdir.nnct.ct | Directional Segregation Test for Two Classes with Normal Approximation
Zdir.nnct.ss | Directional Segregation Test for Two Classes with Normal Approximation (for Sparse Sampling)
Zdir.nnct.ss.ct | Directional Segregation Test for Two Classes with Normal Approximation (for Sparse Sampling)
Zmixed.nonref | Mixed-Non-Reflexivity Test with Normal Approximation
Zmixed.nonref.ct | Mixed-Non-Reflexivity Test with Normal Approximation
Znnref | Z Tests for NN Reflexivity
Znnref.ct | Z Tests for NN Reflexivity
Znnself | Self-Reflexivity Tests with Normal Approximation
Znnself.ct | Self-Reflexivity Tests with Normal Approximation
Znnself.sum | Cumulative Species Correspondence Test with Normal Approximation
Znnself.sum.ct | Cumulative Species Correspondence Test with Normal Approximation
Znnsym | NN Symmetry Test with Normal Approximation
Znnsym.dx | Dixon's Pairwise NN Symmetry Test with Normal Approximation
Znnsym.dx.ct | Dixon's Pairwise NN Symmetry Test with Normal Approximation
Znnsym.ss | Pielou's Pairwise NN Symmetry Test with Normal Approximation (for Sparse Sampling)
Znnsym.ss.ct | Pielou's Pairwise NN Symmetry Test with Normal Approximation (for Sparse Sampling)
Znnsym2cl | NN Symmetry Test with Normal Approximation for Two Classes
Znnsym2cl.dx | Dixon's NN Symmetry Test with Normal Approximation for Two Classes
Znnsym2cl.dx.ct | Dixon's NN Symmetry Test with Normal Approximation for Two Classes
Znnsym2cl.ss | Pielou's First Type of NN Symmetry Test with Normal Approximation for Two Classes (for Sparse Sampling)
Znnsym2cl.ss.ct | Pielou's First Type of NN Symmetry Test with Normal Approximation for Two Classes (for Sparse Sampling)
Zseg.coeff | Z Tests for Segregation Coefficients
Zseg.coeff.ct | Z Tests for Segregation Coefficients
Zseg.ind | Z Tests for Segregation Indices
Zseg.ind.ct | Z Tests for Segregation Indices
Zself.ref | Self-Reflexivity Test with Normal Approximation
Zself.ref.ct | Self-Reflexivity Test with Normal Approximation
ZTcomb | Z-test for Cuzick and Edwards T_{comb} statistic
ZTkinv | Z-Test for Cuzick and Edwards T_k^{inv} statistic
ZTkinv.sim | Z-Test for Cuzick and Edwards T_k^{inv} statistic
ZTrun | Z-test for Cuzick and Edwards T_{run} statistic

## -- misc --

.onAttach | .onAttach start message
.onLoad | .onLoad getOption package settings