Testing Spatial Symmetry Using Contingency Tables Based on Nearest Neighbor Relations

We consider two types of spatial symmetry, namely, symmetry in the mixed or shared nearest neighbor (NN) structures. We use Pielou's and Dixon's symmetry tests which are defined using contingency tables based on the NN relationships between the data points. We generalize these tests to multiple classes and demonstrate that both the asymptotic and exact versions of Pielou's first type of symmetry test are extremely conservative in rejecting symmetry in the mixed NN structure and hence should be avoided or only the Monte Carlo randomized version should be used. Under RL, we derive the asymptotic distribution for Dixon's symmetry test and also observe that the usual independence test seems to be appropriate for Pielou's second type of test. Moreover, we apply variants of Fisher's exact test on the shared NN contingency table for Pielou's second test and determine the most appropriate version for our setting. We also consider pairwise and one-versus-rest type tests in post hoc analysis after a significant overall symmetry test. We investigate the asymptotic properties of the tests, prove their consistency under appropriate null hypotheses, and investigate finite sample performance of them by extensive Monte Carlo simulations. The methods are illustrated on a real-life ecological data set.


Introduction
The analysis of spatial point patterns in natural populations (in R 2 and R 3 ) has been studied extensively. In particular, spatial patterns in epidemiology, population biology, and ecology have important practical consequences. Since the early days of this research, most of the research has been on data from one class, that is, on spatial pattern of one class with respect to the ground (e.g., intensity, clustering, etc). An example of a pattern in a one-class framework is aggregation [1]. It is also of practical importance to investigate the spatial interaction between two or more classes, for example, spatial patterns of one class with respect to other classes [2]. Two frequently studied spatial patterns between multiple classes or species are segregation and association. Segregation occurs when an individual is more likely to be found near conspecifics (i.e., individuals of the same species) [3] and association occurs when an individual from one class is more likely to be found near individuals from the other class.
There are many tests available in the literature for the analysis of spatial point patterns in various fields. An extensive survey is provided by Kulldorff [4] who enumerates more than 100 such tests, most of which need adjustment for some sort of inhomogeneity. However, none of the tests surveyed by Kulldorff [4] are designed for testing spatial symmetry. Most of the tests for multiple classes deal with the existence (or lack) of spatial interaction (in the form of spatial association or segregation) between the classes.
In the literature, Baczkowski and Mardia [5] proposed methods for testing spatial symmetry based on the sample semivariogram. Their methods are applicable for a Gaussian doubly geometric process on a regular lattice. The latest methods for testing and detecting isotropy, symmetry, and separability in spatiotemporal models are discussed in a recent book by Sherman [6] who investigated these properties in the directional sense. For example, isotropy is assessed in the sense of direction-independence of the second-order properties of the spatial point pattern. Spatial symmetry is not only useful in ecological contexts (as in spatial symmetry of plant species in a region of interest), but also in socioeconomic theory to help understand spatial equilibrium configurations [7]. Axial symmetry methods based on the sample periodogram for data collected on a rectangular lattice are also considered and shown to perform well in Scaccia and Martin [8]. 2 The Scientific World Journal The methods discussed in the current paper are the spatial symmetry tests based on NN relationships. There are at least six different groups of NN methods for spatial patterns (see, e.g., [9]). These methods are based on some measure of (dis)similarity between a point and its NN, such as the distance between the point and its NN or the class types of the point and its NN. For example, Pielou [2] constructed nearest neighbor contingency tables (NNCTs) which yield tests of segregation (positive or negative), symmetry, and niche specificity, and a coefficient of segregation in a twoclass setting. Additionally, Dixon devised overall, class-and cell-specific tests based on NNCTs for the two-class case in [10] and extended his methodology to multiclass case in [3]. Pielou's and Dixon's symmetry tests are designed to detect the symmetry (or lack of it) in the mixed or shared NN structure and are the only tests for detecting such symmetry structure (to the authors knowledge). Symmetry in mixed NN structure implies equality of the expected values of the number of NN pairs in which the points in the pair are from different classes, while symmetry in shared NN structure implies that the proportion-with respect to the class sizeof number of times points from one class serving as NN to other classes is equal for all classes. Asymmetry in mixed NN structure would be suggestive of different types or levels of spatial interaction between the two classes of points, while asymmetry in shared NN structure would indicate differences in spatial distribution of points from one class with respect to all the points (from both classes) in the study region compared to that of points from the other class.
Pielou has described her symmetry tests for completely mapped data in R 2 , although her tests are not appropriate for such data [10,11]. A data set is completely mapped, if the locations of all events in a defined space are observed. We assume that data is sparsely sampled; that is, only a (random) subset of NN pairs is observed for Pielou's first type of symmetry test. Pielou's first type of symmetry and Dixon's symmetry test are based on the NNCTs that are constructed using the NN frequencies. Both tests are defined for the two-class case only. Pielou's second type of symmetry test is based on the frequencies of number of times points in a class serve as NNs yielding a contingency table which we callsymmetry contingency table. So, points from each class are categorized into six groups, namely 0, 1, . . . , 5, where a point serving as a NN to no other point is in category "0, " to one other point is in category "1, " and so on. Due to geometric constraints, in R 2 , a point can not serve as a NN to more than six points. For data from a continuous distribution, a point can serve as a NN to at most five points almost surely. Under spatial symmetry in shared NN structure in a multiclass case, the frequencies of these six categories should have the same distributional form for each class.
Pielou's symmetry tests were introduced and illustrated in [2], while Dixon's symmetry test was introduced in passing in [10]. None of tests were extensively studied nor investigated for size and/or power performance. In this paper, we investigate the underlying assumptions for these symmetry tests. We derive their asymptotic distributions under appropriate null hypotheses and extend these symmetry tests to multiclass case. In particular, we demonstrate that Pielou's first type of symmetry test is extremely conservative when used as McNemar's test with its asymptotic critical value and hence should be avoided in practice (or its Monte Carlo randomized version can be used). We also show that various patterns can constitute as the null case for Dixon's symmetry test and Pielou's second type of symmetry test but derive the asymptotic distributions of these tests under CSR independence and RL patterns only. We also investigate the use of Fisher's exact test on the -symmetry contingency table used for Pielou's second type of symmetry test (for shared NN structure). Moreover, the tests discussed in this paper are constructed using the NN relations based on the usual Euclidean distance; so we discuss the generalization of the tests for the case in which NN relations are defined by a dissimilarity measure. Furthermore, we discuss the extension of the methodology to high or infinite dimensional data. In a multiclass setting, first the overall symmetry is tested and if the overall test is significant we propose various post hoc tests such as pairwise symmetry tests or one-versus-rest type tests. The local asymptotic power of the tests is also investigated using the local approximation of the power function or Pitman asymptotic efficiency. Finite sample empirical (size and power) performance comparisons are investigated by Monte Carlo simulations.
We describe and discuss switch the order of these two parts, tests of symmetry in NN structure, their extension to multiclass case, and the corresponding sampling frameworks for the cell counts (i.e., entries in the contingency tables) in Section 2. We discuss the variants of Fisher's exact test for the -symmetry contingency table in Section 3 and asymptotic power analysis (i.e., consistency of the tests and their asymptotic efficiency) in Section 4 and provide an extensive empirical performance analysis by Monte Carlo simulations in Section 5. We discuss the use of one-versus-rest and pairwise tests as post hoc tests in Section 6, illustrate the methodology on an ecological data set in Section 7, discuss the extension of the methodology to the case where NN relations are defined with dissimilarity measures in Section 8, and provide some guidelines and discussion in Section 9.

Tests of Symmetry in the NN Structure
Two or more classes may exhibit many different forms of spatial asymmetry. Although it is not possible to list all possible asymmetry types or configurations, existence of asymmetry can be detected by an analysis of the NN relationships of the class members.

Preliminaries.
The null case for asymmetry alternatives is that there is symmetry in the allocations of points with respect to each other. In particular, consider symmetry in mixed NN structure for two classes and . Then the null case is that the expected number of times class points serving as NN to class would be the same as the expected number of times class points serving as NN to class . On the other hand, for symmetry in shared NN structure, the vector of relative frequencies (with respect to the class size) of points from each class serving as NN to other points is the same for all classes. In general, the null hypothesis for symmetry The Scientific World Journal 3 in mixed NN structure would be implied by a more general pattern, namely, if there is randomness in the NN structure in such a way that the probability of a NN of a point being from a class is proportional to the relative frequency of that class. This assumption holds, for example, under RL or CSR independence of the points from each class. Under CSR independence, the points from each class are independent realizations of homogeneous Poisson process (HPP) with fixed class sizes. In particular, conditioned on the class sizes, the points are independently uniformly distributed in the region of interest. Under RL, class labels are independently and randomly assigned to a set of given locations, where these locations could be from HPP or some other clustered or regular pattern. The null hypothesis for symmetry in shared NN structure would be implied if there is randomness in the NN structure in such a way that the probability of a point from a class serving as NN to other points is proportional to the relative frequency of that class. This assumption also holds under RL or CSR independence of the points from each class. Therefore, both CSR independence and RL patterns would imply symmetry in the mixed or shared NN structure.
Pielou suggests two types and Dixon suggests one type of symmetry tests in the two-class case. Pielou's first type of symmetry test and Dixon's symmetry test are defined for the two-class case only and are based on the corresponding 2 × 2 NNCT. We provide a brief description of NNCTs; for a more detailed discussion see, for example, [12]. Suppose that there are = 2 classes labeled as {1, 2}. NNCTs are constructed using NN frequencies for each class. Let be the number of points from class for ∈ {1, 2} and = 1 + 2 . If we record the class of each point and its NN, the NN relationships fall into 2 = 4 categories: (1, 1), (1, 2); (2, 1), (2,2), where in category ( , ), class is the base class and class is the class of the NN. Denoting as the observed frequency of category ( , ) for , ∈ {1, 2}, we obtain the NNCT in Table 1, where is the sum of column ; that is, a number of times class points serve as NNs for ∈ {1, 2}. Note also that = ∑ 2 =1 , = ∑ 2

=1
, and = ∑ , . Throughout the paper, we adopt the convention that random variables are denoted with upper case letters and fixed quantities with lower case letters. Notice that row sums (i.e., class sizes) are assumed to be fixed, while column sums (i.e., number of times a class serves as NN) is random in our NNCTs.

Pielou's First Type of Symmetry Test.
Pielou's first type of symmetry test involves testing equality of expected values of mixed NN frequencies, that is, the equality of expected values of off-diagonal entries in the NNCT. So Pielou's first type of symmetry test is used to detect the symmetry in the "mixed NN structure. " In this case, if 12 ≈ 21 , spatial allocation of points from two classes is symmetric with respect to the (mixed) NN structure; otherwise, the population is asymmetric. When two classes, and , are of equal size, in a symmetric population, points from each class are equally likely to serve as NN to points from the other class, and, in an asymmetric population, points from one class, say class , tend to serve more as NN to points from class compared to class serving as NN to points from class . So the null hypothesis is which may have various forms based on the assumed underlying frameworks for the contingency tables in general and for the NNCTs. The two-sided alternative is usually a more reasonable alternative, although one-sided alternatives are also possible. Pielou [2] tests for significant differences between 12 and 21 with a 2 test (with Yates' correction) with 1 df using which is the same as the McNemar's test with continuity correction [13]. This test is appropriate only for sparsely sampled data and large 12 + 21 with neither 12 or 21 being too small compared to each other and applicable only for the two-class case. So we suggest the approach recommended in Remark 1 below. The discussion till the end of this subsection is for (properly) sparsely sampled data. Furthermore, in a population in which two classes are highly segregated or the intensities (number of points per unit area) of the classes are very different, the frequencies 12 and 21 can be too small, which renders the 2 approximation inappropriate for the test in (2). In such a case, one can use the exact finite sample distribution of 12 which follows a binomial distribution (conditionally). Given that 12 + 21 = , the test statistic 12 has a BIN( , 1/2) distribution under for properly sparsely sampled data, where BIN( , ) stands for the binomial distribution with independent trials with probability of success . So, for small , the statistic, 12 , can be used with the binomial critical values. For large , has approximately (0, 1) distribution, so I can be used for the one-sided alternatives. Furthermore, the test X 2 I in (2) has approximately 2 1 distribution, which can only be used for the two-sided alternative.
Pielou's first type of symmetry test can be extended to the multiclass case (with > 2) as The Scientific World Journal Under : " = , for all ̸ = ", X 2 I in (4) is the same as Bowker's test of symmetry, which is an extension of McNemar's test for the × contingency tables [14]. The test statistic in this case has 2 ( −1)/2 distribution asymptotically. is the probability of an experimental unit being from row category and column category simultaneously and M( , 1 , 2 , . . . , ) standing for the multinomial distribution with independent trials and the probability of a trial resulting in category is with ∑ =1 = 1. In the 2 × 2 contingency table, the rows will have two entries, so the multinomial distribution reduces to a binomial distribution. More specifically, we would have 1 ∼ BIN( , 1 ) (or 2 ∼ BIN( , 2 )) for = 1, 2.
In a NNCT, is the number of classes and is the probability of a point from class serving as a NN to a point from class for , ∈ {1, 2, . . . , }. However, a NNCT is unlikely to result from a row-wise multinomial framework. In a NNCT, a trial is the categorization of a base-NN pair; that is, a trial is "determining the type of a base-NN pair. " For entry ( , ), a trial results in success, if a base-NN pair belongs to category , (i.e., base point is from class and its NN point is from class ). For example, in a 2 × 2 contingency table, in general, ( 11 , 12 ) and ( 21 , 22 ) are assumed to be independent and so are the individual trials under the row-wise multinomial framework. This assumption is invalid when the NNCT is based on completely mapped data because independence between rows is violated (see also Remark 1). If the NNCT is constructed using a random sample of base-NN pairs, then the usual contingency table assumptions under the row-wise multinomial framework would hold. Such a NNCT can be (approximately) obtained only if a (small) subset of all the base-NN pairs obtained from the data in the study region was randomly selected; that is, if the data is obtained by an appropriate sparse sampling. When the data were properly sparsely sampled, we will assume that the NNCT satisfies the usual independence assumptions in the row-wise multinomial framework henceforth. In this framework, the explicit form of the null hypothesis becomes When the 2×2 NNCT is constructed from a sparsely sampled data, the rows are assumed to be from the same multinomial distribution, so the entries in row satisfy ∼ BIN( , ) for = 1, 2, where is the probability of a NN point being from class . Then, under in (5) For a NNCT, if the data is completely mapped, independence between trials is violated again. Under sparse sampling, this framework is able to model a NNCT approximately. That is, if the NNCT is based on a random sample of base-NN pairs, it will (approximately) satisfy the assumptions in the overall multinomial framework because of the inherent correlation between components or entries of a multinomially distributed random variable. For example, in a two-class setting with sparsely sampled data, we have where ] 1 + ] 2 = 1 and 1 + 2 = 1. Then the null hypothesis of symmetry becomes which is equivalent to : ] 1 2 = ] 2 1 or equivalently : ] 1 = 1 since 2 = 1 − 1 and ] 2 = 1 − ] 1 . Row-wise and overall multinomial frameworks are closely related. Conditional on = , the overall multinomial framework reduces to the row-wise multinomial framework. But a NNCT for completely mapped data does not fit to the overall multinomial framework either, due to the inherent spatial dependence and the row sums being fixed. McNemar's test (and hence Bowker's test) is only appropriate in the overall multinomial framework and is extremely conservative for the row-wise multinomial framework. In particular, in a NNCT for completely mapped data, we have row sums (i.e., class sizes) fixed as in the row-wise multinomial framework. Hence, Pielou's first type of symmetry test would also be extremely conservative for the NNCTs. Remark 1. In Pielou's first type of symmetry test, both of the above multinomial frameworks assume that the trials are independent multinomial trials. However, when a trial is the base-NN relation, the assumption of independence between trials is violated. The dependence mainly originates from the fact that a point is more likely to be the NN of its own NN (i.e., more likely to form a reflexive (base, NN) pair); hence, many reflexive pairs are possible. Thus, Pielou's test is influenced by deviations not only from the null case but also by deviations The Scientific World Journal 5 from dependence on trials. The dependence due to reflexivity can not merely be avoided by random subsampling but can be circumvent by an appropriate sparse sampling [15]. The assessment of various sparse sampling schemes for these tests is a topic of ongoing research. Furthermore, Pielou's first type of symmetry test requires the NNCT resulting from an overall multinomial framework, which does not hold for a NNCT based on completely mapped data either. So Pielou's first type of symmetry test is only appropriate under the overall multinomial framework (with random row sums), which can be satisfied by an appropriate sparse sampling. Our suggestion for Pielou's first type of symmetry test is as follows. If the data is properly sparsely sampled under the overall multinomial framework, then one can employ it. But if the data is completely mapped, to remove the influence of spatial dependence on Pielou's first type of symmetry test, we suggest the usual Monte Carlo randomization, where class labels are randomly assigned to the given points a large number of times and test statistics are computed, and the value of the test is based on the rank (scaled by the number of Monte Carlo replications) of the test statistic of the original data in the sample of test statistics obtained from Monte Carlo randomization procedure.

Dixon's Symmetry Test.
Dixon [10] also suggested a symmetry test for testing the equality of frequency of mixed NNs (or between class NNs), that is, the equality of the expected values of the off-diagonal entries in the 2×2 NNCTs. So the null hypothesis is given by and, under RL or CSR independence, E[ ] = / for ̸ = . Notice that the null hypotheses for Dixon's symmetry test and Pielou's first type of symmetry test look identical; however, the corresponding underlying assumptions are different. Pielou's first type of symmetry test is only appropriate when the data are (properly) sparsely sampled under overall multinomial framework, whereas Dixon's symmetry test is appropriate when the data are completely mapped. That is, Pielou's first type of symmetry test is appropriate when we have a random sample of base-NN pairs under overall multinomial framework; that is, between-row independence assumptions are satisfied (up to the inherent correlation for multinomial entries) and, hence, ignore the spatial information. On the other hand, Dixon's test can be used for completely mapped data and takes the spatial dependence into account.
Under RL, the test statistic for Dixon's symmetry test is given by Here , , and are the probabilities that a randomly picked pair, triplet, or quartet of points, respectively, are from the indicated classes and are given by Furthermore, is the number of points with shared NNs, which occurs when two or more points share a NN and is twice the number of reflexive pairs. Then = 2( 2 + 3 3 + 6 4 + 10 5 + 15 6 ), where is the number of points that serves as a NN to other points times. For large , asymptotically has (0, 1) distribution. A two-sided alternative and one-sided alternatives are possible with the test statistic, . We describe this setting in a broader context with ≥ 2 classes. Let ] be the probability of an arbitrary point being from class and ] be the probability of a base-NN pair with base point being from class and its NN being from class . Then, under RL, we have ] = ] ] and the expression ( ( − 1)/ ( − 1))I ( = ) + ( / ( − 1))I ( ̸ = ) can be viewed as an estimator or approximation for ] for large , where I(⋅) stands for the indicator function. Furthermore, for large , the null hypothesis of symmetry is equivalent to which has length ( −1)/2. Under RL, approximately has (0, 1) distribution.
To combine the entries of the vector T in one overall test statistic for symmetry, we also need the covariance matrix of T , denoted Σ sym . The diagonal entries of T are Var[ − ] in the order of entries of T . For the off-diagonal entries, we need the covariance terms Cok[ − , − ]. By construction, we have < and < and there are six cases regarding these covariance terms.
The covariance term in Case 6 above is zero, since Notice that Σ sym is a × matrix with = ( − 1)/2 and E[T ] = (0, 0, . . . , 0). Then asymptotically has 2 distribution. For a two-class population, the observations are sorted into two sets of frequencies, namely, ,0 , ,1 , . . . , ,5 , for = 1, 2, where , is the frequency of class observations serving as a NN to other points for ∈ {0, 1, 2, 3, 4, 5}. So Pielou's second type of symmetry test uses more spatial information than just the categorization of base-NN relations. Notice that , is also the number of class points shared as a NN by other points.

Pielou's Second Type of Symmetry
The corresponding contingency table for the two-class case is given in Table 2(a), where is the column sum, that is, the total number of points serving as a NN times or the number of points shared as a NN by other points for ∈ {0, 1, 2, 3, 4, 5}. Only if the allocation of the points from both populations is symmetric in terms of frequency of "serving as a NN" property, the expected proportions of classes 1 and 2 points serving as NNs times will be the same for each value. Hence, this type of symmetry refers to "symmetry in shared NN structure. " Let ⃗ = ( ,0 , . . . , ,5 ) be the vector of probabilities (or proportions) associated with row for = 1, 2 in the -symmetry contingency table under the row-wise multinomial framework. In a -symmetry contingency table, sum of row equals (i.e., size of class ). Hence, -symmetry contingency table may not result from the overall multinomial framework, since row sums in a -symmetry contingency table are fixed for completely mapped data. Furthermore, under RL, column sums are fixed and hence can be denoted as = , but, under CSR independence, are random quantities. Thus, the null hypothesis of symmetry in the shared NN structure is given by In general, if the independence assumptions in the rowwise multinomial framework hold, we would have E[ , ] = / . Then we may test the equality of proportions by using the usual Pearson's 2 test which has approximately a 2 5 distribution for large . Under RL, although it would be possible for a point to serve as NN to 6 other points with a positive probability (depending on the fixed allocation of the points), we will only consider up to 5 (and combine 5 and 6 categories and treat them as one category). If these categories have nonnegligible counts, then the above discussion can easily be extended to the case that shared NN frequencies have 7 levels, and the corresponding test has 2 6 distribution for large . A conservative requirement for the cell frequencies in the contingency table is that no expected cell count is less than 1 and no more than 20% of the cell counts are less than 5 [16]. Otherwise, it is recommended to merge some of the categories. For the -symmetry contingency table, in practice, such a merging would usually be necessary for ≥ 2, whence the dimension of the contingency table becomes 2×3 and df becomes 2. Large values of X 2 II indicate deviations from the null case. Hence, if the value is significant, then the population can be assumed to be asymmetric in the shared NN structure in the sense that the distribution of the rows in the -symmetry contingency table would be different for the two classes; that is, there is significant asymmetry in the shared NN structure.
Pielou's second type of symmetry test can immediately be extended to the multiclass case. With > 2, we record the frequency of class members serving as NN times in a × 6 contingency table (merging cells when necessary which might be needed for ≥ 2). Then we obtain the contingency table given in Table 2(b). In the -class case, the null hypothesis is The corresponding test statistic X 2 ) would be approximately distributed as 2 5( −1) (and when columns are merged for ≥ 2, we obtain a × 3 -symmetry contingency table and the asymptotic distribution is 2 2( −1) ) for large and provided that the independence assumptions in the row-wise multinomial framework hold.
This test seems to arise from the row-wise multinomial framework by construction, with the test statistic, X 2 II , given in (20). Furthermore, the trials here are "base point-" "number of times the point serving as a NN" or "base point-" "number of times the point is shared as a NN. " Under RL or CSR independence, between row or column independence is violated for the -symmetry contingency table. For example, under RL with two classes, 1, and 2, are highly correlated; in fact, correlation between them is −1 when = 2, since 2, = − 1, . Furthermore, , and , are also highly dependent and so are , and , . Hence, the suggested asymptotic distribution for X 2 II should be appropriate under sparse sampling only. However, our extensive Monte Carlo simulations suggest that the asymptotic approximation with the reduced contingency table using 2 2( −1) distribution seems to hold for completely mapped data as well. Therefore, the test seems to be appropriate for both sparsely sampled or completely mapped data. Yet, finding the exact and asymptotic distribution of X 2 II is still open problems.

Fisher's Exact Test for the -Symmetry Contingency Table
Fisher's exact test is widely used for contingency tables for small sample sizes (see, e.g., [17] If calculated manually, Fisher's exact test is feasible only for small size contingency tables. Furthermore, the underlying assumption of the Fisher's exact test is that the total number of observations, row and column sums are fixed, so Fisher's exact test is a test conditional on the marginals. For × contingency tables, when = = 2, then Fisher's exact test can be one-sided or two-sided, whereas, when min( , ) > 2 (hence for the -symmetry contingency table), it is twosided only [17].
There are numerous ways to obtain values for the twosided alternatives for exact inference on contingency tables [17]. These variants of Fisher's exact test are described below. The values based on Fisher's exact tests tend to be more conservative than most approximate (asymptotic) ones [17].

Variants of Fisher's Exact Test for Two-Sided Alternatives.
To find the values for Fisher's exact test, we find the probabilities of the contingency tables obtained from the distribution with the same row and column marginal sums. For the two-sided alternatives, a recommended method is adding up probabilities of contingency tables of the same size and smaller than the probability associated with the current table. Alternatively, twice the one-sided value can also be used for a 2 × 2 contingency table [17]. Let the probability of the × contingency table, , be denoted as ( ), where min( , ) > 2, and let sum of row be , let sum of column be , and let entry , be . Then the probability of the contingency table, , is [13] In particular, for the 2 × 3 reduced -symmetry contingency table, we get Let the probability of the current contingency table be denoted as .
For summing the values of more extreme tables than the current table in both directions, the following variants of the exact test are obtained. The value is calculated as = ∑ ( ) for the appropriate choice of the set of contingency tables, , as follows: Tocher's correction makes Fisher's exact test less conservative, by including the probability for the current table based on a randomized test [19]. When table-inclusive version of the value, inc , is larger than the level of the test , but tableexclusive version, exc , is less than , a random number, , is generated from uniform distribution in (0, 1), and if ≥ ( − exc )/ , then inc is used as the value, otherwise exc is used as the value. That is, Observe that exc = inc − and mid = exc + /2. Additionally, exc ≤ Toc ≤ inc < ,inc and exc < mid < inc < ,inc .

Asymptotic Power Analysis
The null hypotheses are different for the symmetry tests and so are the alternative hypotheses. This makes the comparison of the tests inappropriate even for large samples; however, under specific alternatives and assumptions, we can estimate asymptotic efficiency scores, such as those of Pitman asymptotic efficiency. A reasonable test should have more power as the sample size increases. So, we first prove the consistency of the tests in question under appropriate hypotheses.
Proof. In the multiclass case with ≥ 2, deviations from may have many possible forms. In any deviation from , that is, under , for large , X 2 II is approximately distributed as a 2 distribution with noncentrality parameter ( ⃗ ) and 5( − 1) df, which is denoted as 2 5( −1) ( ( ⃗ )). The noncentrality parameter is a quadratic form which can be written as ⃗ ( ⃗ ) ⃗ ( ⃗ ) for some positive definite matrix of rank 5( −1) (see, e.g., [20]); hence, ( ⃗ ) > 0 under . Then, for large , the null and alternative hypotheses are equivalent to : = 0 versus : = ( ⃗ ) > 0. Then, by standard arguments for the consistency of 2 -tests, the result follows.  (4) is consistent. The corresponding one-sided tests using given in (3) are also consistent.
Proof. In the two-class case, recall that this test is the same as McNemar's test with a continuity correction. Given that 12 + 21 = , the correction is used for small and its impact vanishes as → ∞. So we prove the consistency for the uncorrected version (i.e., for the test without continuity correction), and consistency of X 2 I follows as in the proof of Theorem 2.

Theorem 4. Let the NNCT be constructed from a completely mapped data under RL. Then Dixon's symmetry test, that is, the test rejecting
: (18) is consistent. The corresponding one-sided tests using given in (10) are also consistent.
Proof. In the two-class case, let and is approximately distributed as (0, 1) for large under the null hypotheses. Under , Hence, the test using is consistent. The -level test based on X 2 is consistent as in the proof of Theorem 2, since X 2 is a quadratic based on values; that is, X 2 ∼ 2 df ( ( )) for some ( ) > 0.
Remark 5. The consistency result for Pielou's first type of symmetry test is only for sparsely sampled data with contingency table from the overall multinomial framework. Pielou's second type of symmetry test is consistent only for sparsely sampled data with the row-wise multinomial framework. For completely mapped data, these tests do not have the appropriate size. In particular, Monte Carlo simulations suggest that Pielou's first type of symmetry test (with 2 approximation or exact binomial version) is extremely conservative. See also Section 5.

Asymptotic Power Comparison of the Tests.
The power of a test in hypothesis testing depends on the statistic being employed, sample size, the level of the test , and the parameter(s) under . To be able to compare the tests, we should consider the asymptotics with only → ∞, where the asymptotic power tends to 1 for consistent tests. Since the power depends on multiple parameters, many asymptotic efficiency methods are introduced to compare asymptotic power performance. See [21] for a brief survey of asymptotic efficiency measures.
The tests with small level and high power under alternatives close to null hypothesis have practical importance. Hence, Pitman asymptotic efficiency (PAE) is widely used in practice. PAE analysis provides for an investigation of local power around , which involves the limit as → ∞ together with the limit of alternative parameter converging to the null parameter. See, for example [22,23] for more details.
Remark 6. Suppose that the distribution under consideration can be indexed by Θ ⊆ R and consider : = 0 versus : > 0 . If the test statistic satisfies central limit theorem together with the Pitman's conditions [23] with = E[ ] and 2 = Var[ ], then PAE of is given by If a test statistic, , converges in law to 2 ] distribution as → ∞, then the local power approximation using asymptotic normality of is not appropriate [24]. By suitable transformations, the corresponding test asymptotically boils down to : = 0 versus : > 0, where is the noncentrality parameter for the 2 ] distribution. Therefore, we investigate the local power around = 0. Let ] ( , ) and ] ( , ) be the pdf and cdf of 2 ] ( ) distribution, respectively.

Theorem 7.
Suppose that 2 is a test statistic which converges in law to 2 ] ( ) with = 0 under and to 2 ] ( ) with > 0 under . Then the local power for small ( around 0) is given by The proof is provided in the Appendix.  [23]). Then by Remark 6, the PAE of (for the parameterization :

Asymptotic Local
The asymptotic local power for Dixon's symmetry test for the two-class case can also be investigated with PAE analysis. For Dixon's symmetry test for the two-class case, consider = ( 12 − 21 )/ . Then where for large for ( , ) ∈ {(1, 2), (2, 1)} and For the asymptotic relative efficiency between Pielou's first type of symmetry test and Dixon's symmetry test to make sense, the null assumptions for these tests should match and so should the alternatives and the parameterizations of the alternatives (under which PAE scores are computed). Otherwise, PAE( I ) and PAE( ) would not be comparable. In particular, since the (appropriate) null and alternatives are different for these tests, we refrain from computing asymptotic relative efficiency for these tests. On the other hand, for Dixon's symmetry test with varying ] 1 and , notice that PAE( ) increases as ] 1 gets closer to 0 or 1 or gets smaller. For example, for fixed , PAE of gets larger as the relative abundances of the classes get more and more different (which implies that ] 1 gets closer to 0 or 1). The smallest PAE( ) values are obtained when ] 1 = ] 2 = 1/2 for any > 0. That is, the power of Dixon's test for spatial symmetry (in mixed NN structure) highly depends on the relative abundances of the classes. The PAE of in the multiclass case is similar.

Empirical Performance of the Tests
In this section we investigate the finite sample behavior of the tests under various patterns via Monte Carlo simulations. In what follows empirical size estimates are based on the asymptotic critical values (except for the exact tests). In particular, for a test, , with a 2 df distribution asymptotically, empirical sizes are estimated as follows. Let be the value of test statistic for the sample generated at th Monte Carlo replication for = 1, 2, . . . , mc . Then the empirical size of at level = 0.05, denoted̂, is computed aŝ=

Empirical Performance Analysis under RL and CSR
For an exact test, let be the value for th sample generated. Then the empirical size of this test, denoted̂, is computed aŝ= (1/ mc ) ∑ mc =1 I ( < 0.05). With mc = 10000, an empirical size estimate larger than 0.0536 is deemed liberal, while an estimate smaller than 0.0464 is deemed conservative at .05 level (based on binomial critical values with = 10000 trials and probability of success 0.05).

Empirical Size Analysis under CSR Independence.
We consider the two-class case, with classes 1 and 2 (also referred to as the classes and , resp.) of sizes 1 and 2 , respectively. Let { 1 , . . . , 1 } be the set of class 1 points and let { 1 , . . . , 2 } be the set of class 2 points. Under , at each of mc = 10000 replicates, we generate and points independently of each other and iid from U((0, 1) × (0, 1)), the uniform distribution on the unit square. We consider two cases for CSR independence.  Case 2. To determine the influence of differences in the sample sizes (i.e., differences in relative abundances) on the empirical levels of the tests, we generate the samples from the CSR independence pattern with 1 = 20 and 2 = 20, 30, . . . , 60.
The empirical significance levels (under CSR independence Cases 1 and 2) for the symmetry tests are presented in Table 3, wherêI and̂I are the (estimated) empirical significance levels for Pielou's first type of symmetry test using 2 approximation with and without Yates' continuity correction, respectively;̂b in is for the exact binomial version of Pielou's first type of symmetry test conditional on 12 + 21 = ;̂I I is the empirical significance level for Pielou's second type of symmetry test;̂is for Dixon's symmetry test. Notice that Pielou's first type of symmetry tests and the exact binomial test are extremely conservative. Furthermore, we recommend the use of the Monte Carlo randomized versions of these tests or with Monte Carlo critical values rather than the approximate asymptotic critical values. A Monte critical value is determined as the appropriately ranked value of the test statistic in a certain number of generated data sets under the null hypothesis. The other tests seem to be of the desired level for each sample size considered.
The empirical significance levels for the exact tests on the -symmetry contingency table under CSR independence Cases 1 and 2 are presented in Table 4, wherêi nc is the empirical significance level for the two-sided test with the  the desired level, while the others are more conservative.
Hence, in what follows, only the table exclusive version will be employed for exact inference on -symmetry contingency table.

Empirical Size Analysis under RL.
For the RL pattern, the locations of the points are given and the marks or class labels are assigned randomly to these points. The pattern generating these locations is referred to as the background pattern henceforth. Let Z = { 1 , 2 , . . . , } be the given set of locations for points from the background pattern. We consider RL of class labels of 1 and 2 (or and ) to these points which are generated from homogeneous or clustered patterns. We generate 100 different realizations of the background pattern, Z , to mitigate the influence of a particular background realization on the size performance of the tests. At each background realization, 1 of the points are labeled as class 1 and the remaining 2 = − 1 points are labeled as class 2.
Case 2. The background points, Z , are generated as in Case 1 above with 1 = 20 and 2 = 20, 30, . . . , 60 to determine the differences in the sample sizes with number of class 1 points fixed and number of class 2 points increasing. The above RL scheme is repeated 1000 times for each ( 1 , 2 ) combination of background realization.

12
The Scientific World Journal Case 3. We generate the background points from a Matérn cluster process. More specifically, points are generated from MatClust( , , ) process, which is the Matérn cluster process in the unit square [25]. In this process, first "parent" points are generated from a Poisson process with intensity and then one replaces each parent point by new points which are generated iid inside the circle centered at the parent point with radius . Here is also random; ∼ Poisson( ). At each background realization, one realization of Z is generated from MatClust( , , ). Let be the number of points in a particular realization. Then 1 = ⌊ /2⌋ of these points are labeled as class 1, where ⌊ ⌋ stands for the floor of and 2 = − 1 as class 2. In our simulations, we use = 2, 4, . . . , 10, = ⌊100/ ⌋, and = 0.1. That is, we take ( , ) ∈ {(2, 50), (4,25) . . . , (10, 10)}, in order to have about 100 points, where about half of them are class 1 and the other half are class 2 points on the average. In RL Cases 1 and 2, the points are from HPP in the unit square (with fixed 1 and 2 ), where Case 1 is for assessing the effect of increasing but equal sample sizes on the tests, while Case 2 is for assessing the effect of increasing differences in relative abundances of the classes (with one class size being fixed, while the other is increasing). On the other hand, in Case 3, we have the background realizations with cluster centers and cluster numbers being random. On the average, with increasing , the number of clusters tend to increase, and cluster sizes tend to decrease (so as to have fixed class sizes on the average). Hence, in Case 3, we investigate the influence of increasing number of clusters with randomly determined centers on the size performance of the tests.
The empirical size estimates of the tests under RL Cases 1-3 are presented in Table 5. The empirical size performance of the tests under Cases 1 and 2 is similar to that under CSR independence Cases 1 and 2, respectively. Tests of Pielou's first type of symmetry are extremely conservative, while the other tests are about the desired level. The empirical size estimates of the exact test for Pielou's second type of symmetry (the table exclusive version) are denoted aŝI I for notational convenience. Furthermore,̂I I is close to the nominal level for all sample sizes or values. Notice also that the size estimates of the tests are not influenced by the number of clusters, , when the class sizes are fixed.
Based on the empirical size performance of the tests, we observe that variants of Pielou's first type of symmetry test are extremely conservative and hence are not reliable in practice. On the other hand, Pielou's second type of symmetry test and Dixon's symmetry test are appropriate for balanced or unbalanced sample sizes. When the relative abundances of the classes are close to one (i.e., / ≈ 1 for ̸ = ), we call the class sizes to be balanced, but when the relative abundances deviate substantially from one we call the class sizes to be unbalanced. For the exact tests on -symmetry contingency table, we recommend the table-exclusive version.

Empirical Performance of the Tests under Various Other
Patterns. To assess the empirical performance of the tests, we consider six pattern cases for the NN structure. Empirical rejection rate estimates are computed as the size estimates in Section 5.1. Case I. For the first class of patterns, we generate iid ∼ U((0, 1) × (0, 1)) for = 1, . . . , 1 and iid ∼ BVN(1/2, 1/2, 1 , 2 , ) for = 1, . . . , 2 , where ( 1 , 2 , 1 , 2 , ) is the bivariate normal distribution with mean ( 1 , 2 ) and covariance [ 1 2 ]. In our simulations, we set 1 = 2 = and = 0. We consider three patterns in which The classes 1 and 2 (i.e., and ) have different distributions with different local intensities. In particular, points constitute a realization of HPP process in the unit square, while points are clustered around the center of the unit square, namely (1/2, 1/2). In fact, the level of clustering of points increases as decreases.
The means (±SD (standard deviations)) of the offdiagonal entries, 12 , 21 , and their difference 12 − 21 and empirical rejection rate estimates under the patterns, (i), (ii), and (iii), with 1 = 2 = 40 are presented in Table 6(a), wherê I and̂I stand for the empirical rejection rates for Pielou's first type of symmetry test using 2 approximation with and without Yates' continuity correction, respectively;̂b in is for the exact binomial version of Pielou's first type of symmetry test conditional on 12 + 21 = ;̂is for Dixon's symmetry test;̂I I is for Pielou's second type of symmetry test;̂I I is for the exact test on the -symmetry contingency table. Notice Table 6: Presented are the means (±SD (standard deviations)) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the rejection rate estimates under Case I patterns in (33) with mc = 10000, 1 = 2 = 40 at = .05 (a) and rejection rate estimates based on Monte Carlo randomization with 1 = 2 = 40 and 1000 Monte Carlo randomization steps are performed for each of mc = 1000 generated samples under Case I patterns (b).̂I and̂I stand for the empirical rejection rate estimates for Pielou's first type of symmetry test using 2 approximation with and without Yates' continuity correction, respectively;̂b in stands for the exact binomial version of Pielou's first type of symmetry test conditional on 12 21 values which suggests asymmetry in the mixed NN structure. Furthermore, 12 , 21 tend to decrease with decreasing . That is, when the level of clustering of points in the center of the unit square increases (i.e., level of segregation of points from points increases), the offdiagonal entries tend to decrease (in a similar fashion). The exact binomial version of Pielou's first type of symmetry test has the highest rejection rates which are increasing as is decreasing. The rejection rate estimates for all other symmetry tests are significantly smaller than the nominal level of .05, indicating lack of asymmetry in the mixed and shared NN structure. However, the fact that off-diagonal entries are small seems to render the asymptotic approximations inappropriate. Although the difference of the off-diagonal entries is larger than zero, the standard deviations of the differences are much smaller compared to those under CSR independence or RL (see also Table 7). Moreover, the exact binomial test is not appropriate either due to the dependence between trials (hence dependence between rows of the NNCT) for spatial data. Thus, in this situation, we recommend performing Monte Carlo randomization to determine more reliable rejection rate estimates. To that end, for each of the 100 generated samples under each of Case I patterns, 1000 Monte Carlo resampling is performed, and rejection rate for a test is estimated based on how many of the test statistics on resamplings are at and above the original test statistic. The corresponding Monte Carlo randomization rejection rate estimates are presented in Table 6(b), where the binomial version of Pielou's first type of symmetry test is omitted since it is conditional on 12 + 21 = which is not fixed under Monte Carlo randomization steps. The rejection rate estimates are Case II. For Case II, we consider the following three patterns.
Mean ± SD Rejection rate estimates for Case III patterns 12  1 − . In the pattern generated, are more associated with . The three values of constitute the following patterns: In this case, points constitute a realization of a HPP process in the unit square, while points are clustered around the points and the level of clustering increases as the parameter increases. The means (±SD) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the empirical rejection rate estimates for Case II patterns with 1 = 2 = 40 are presented in Table 8. Notice that 12 and 21 in the NNCTs tend to be similar and larger than expected and 12 values tend to be slightly larger than 21 values. Furthermore, 12 , 21 tend to increase with increasing . That is, when the level of clustering of points around points increases (i.e., level of association of points with points increases), the off-diagonal entries tend to increase (in a similar fashion), indicating symmetry in the NN structure (but the difference between 12 and 21 values tends to increase with increasing ). Variants of Pielou's first type of symmetry test have virtually zero rejection rates, and, although Dixon's symmetry test has higher rejection rates than Pielou's first type, it has rates smaller than 0.05; hence there is symmetry in the mixed NN structure. In fact, under this pattern, expected value of the difference, 12 − 21 , is mostly positive and with a larger variance compared to those under CSR independence and RL. However, there is severe asymmetry in shared NN structure, since Pielou's second type of symmetry test and its exact version have rejection rate estimates much larger than 0.05, and these estimates increase as increases. Hence, this pattern type can serve as an alternative to symmetry in the shared NN structure and perhaps a null pattern for the tests of symmetry in the mixed NN structure for the range of considered. However, using the asymptotic critical values based on the distribution under RL, the tests of symmetry in mixed NN structure would be extremely conservative for this null case. If the correct form of the variance and covariance terms can be determined as a function of , then the tests for symmetry in mixed NN structure would have the desired level.
Notice that these are the segregation patterns considered for Monte Carlo analysis in Ceyhan [12]. The means (±SD)) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the empirical rejection rate estimates for the segregation patterns are presented in Table 9. The offdiagonal entries, 12 , 21 , are very similar under these segregation patterns and are much smaller than expected under RL and tend to decrease as (i.e., level of segregation) increases. Hence, mixed NN structure seems to be symmetric under these segregation patterns. The symmetry tests and the exact tests have very small rejection rates, with Pielou's first type and Dixon's symmetry tests having virtually zero rates and the others having rates lower than .05. There seems to be symmetry in both mixed and shared NN structure, since the null hypotheses seem to be satisfied. That is, the expected difference 12 − 21 is zero, and the cell counts in the -symmetry table are as expected under RL. However, the variances seem to be much smaller compared to the ones under RL or CSR independence (see Table 7). Thus, these segregation patterns can form null patterns for both types of symmetry tests; however, the correct variance and covariance terms should be computed; otherwise, the symmetry tests would be extremely conservative when the critical values are based on the distribution under RL or CSR independence.
Case IV. We also consider patterns in which self-reflexive pairs are more frequent than expected by construction. We generate iid ∼ 1 for = 1, . . . , ⌊ 1 /2⌋ and iid ∼ 2 for The Scientific World Journal 15 = 1, . . . , ⌊ 2 /2⌋. Then, for = ⌊ 1 /2⌋+1, . . . , 1 , we generate = −⌊ 1 /2⌋ + (cos , sin ) and, for = ⌊ 2 /2⌋ + 1, . . . , 2 , we generate = −⌊ 1 /2⌋ + (cos , sin ) , where ∈ (0, 1) and ∼ U(0, 2 ). Appropriate small choices of will yield an abundance of self-reflexive pairs. The three values of we consider constitute the below self-reflexivity patterns at each support pair ( 1 , 2 ). Then the nine pattern combinations we consider are given by the following: The means (±SD) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the empirical rejection rate estimates for Case IV patterns with 1 = 2 = 40 are presented in Table 10. In this case, the off-diagonal entries, 12 , 21 , tend to be very similar but smaller than expected under RL, indicating symmetry in mixed NN structure. Furthermore, as pattern changes from (i) to (iii) 12 , 21 values tend to decrease, and, at each case IV pattern, 12 , 21 values tend to decrease, as (i.e., the level of self-reflexivity) decreases. Variants of Pielou's first type of symmetry test have small rejection rates (with the asymptotic versions having virtually zero rates and the exact version slightly higher rates); Dixon's symmetry test has rejection rates smaller than 0.05. Hence, we conclude that, under these self-reflexivity patterns, there is in fact symmetry in mixed NN structure, as the expected difference 12 − 21 is zero, but the variance of this difference is much smaller than that under RL. Hence, using the asymptotic distribution under RL, these tests would be extremely conservative. To get the desired level, one needs the correct form of the variances and covariances for Dixon's symmetry test under these patterns. On the other hand, Pielou's second type of symmetry tests has rejection rates about the nominal level of .05, indicating that these selfreflexivity patterns can also be viewed as the null pattern for symmetry in the shared NN structure.
Case V. In this case, first, we generate iid ∼ U((0, 1) × (0, 1)) and then generate as = + (cos , sin ) , where ∈ (0, 1) and ∼ U(0, 2 ). In the pattern generated, appropriate choices of will cause and more associated. That is, a point is more likely to be the NN of an point and vice versa. The four values of we consider constitute the four association patterns: The patterns (i)-(iii) are also the association patterns considered for Monte Carlo analysis in Ceyhan [12].
The means (±SD) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the empirical rejection rate estimates for Case V patterns with 1 = 2 = 40 are presented in Table 11. Notice that the off-diagonal entries, 12 , 21 , tend to be at or above the expected value under RL and tend to increase as (i.e., level of association) increases. Furthermore, 12 values tend to be slightly smaller than 21 values and the differences between 12 and 21 tend to decrease as decreases. Variants of Pielou's first type of symmetry test have virtually zero rejection rates, and, under stronger association with 1/7 ≤ ≤ 1/10, Dixon's symmetry test and exact and asymptotic versions of Pielou's second type of symmetry test have rates around .05, and, under moderate association with 1/2 ≤ ≤ 1/4, these tests have rates mildly above .05. Hence, stronger association with 1/7 ≤ ≤ 1/10 could serve as the null pattern for both types of symmetry tests, while, under moderate association with 1/2 ≤ ≤ 1/4, the expected values are smaller in the negative direction compared to those under RL, with the variances about those under RL.
Mean ± SD Rejection rate estimates for Case IV patterns 12 Table 11: The means (±SD) of the off-diagonal entries, 12 , 21 , and their difference 12 − 21 and the rejection rate estimates for Case V patterns with mc = 10000, 1 = 2 = 40 at = .05. Column labeling is as in Table 6.
Mean ± SD Rejection rate estimates for Case V patterns 12  Hence, there is strong asymmetry in mixed and shared NN structure, and the level of asymmetry is increasing with decreasing . Thus, these patterns can serve as alternative patterns for both types of symmetry tests and the rejection rates are power estimates. Notice also that the asymmetry in the shared NN structure is stronger than the asymmetry in the mixed NN structure.

Pairwise versus One-versus-Rest Tests
In the multiclass case with > 2, we first perform an overall omnibus test (as in ANOVA -test for multigroup comparisons) and then, if the omnibus test is significant, then we perform post hoc tests to determine the specifics of the differences. These post hoc tests could be pairwise tests (as in pairwise -tests) or one-versus-rest tests, where one class is compared with respect to all other classes combined. More specifically, with > 2 classes, in the pairwise comparison, we only consider classes ̸ = . The pairwise tests for Dixon's symmetry test and Pielou's second type of symmetry test can be defined in two different ways: (i) unrestricted pairwise symmetry tests and (ii) restricted pairwise symmetry tests. In the unrestricted version, for the pairwise test for classes , , ̸ = , we keep all the points in consideration. That is, for Dixon's symmetry test, we extract and from the overall × NNCT and, in computing and values, we do not ignore but use all the other classes. In the restricted version, we restrict our attention to two classes, , , with ̸ = , only, and treat the classes as in the two-class case. That is, we only consider classes and and ignore the remaining classes and hence obtain a 2 × 2 NNCT just for classes and extract 12 and 21 from this NNCT, and compute and for the data consisting of classes and only. The unrestricted version of Pielou's second type symmetry is based on the contingency table extracting only row and in the -symmetry contingency table. On the other hand, in the restricted version, we compute a 2×3 -symmetry contingency table based on data consisting of classes and only.
In the one-versus-rest type of test for class , we pool the remaining classes and treat them as the other class in a twoclass setting and hence the name one-versus-rest test. In a multiclass setting with classes, there are one-versus-rest type tests and ( 2 ) = ( − 1)/2 pairwise tests. As increases, performing one-versus-rest analysis is computationally less intensive and easier to interpret.
Although Pielou  In the mixed or shared NN structure, significant overall tests indicate some form of deviation from symmetry for all classes combined, while the post hoc tests suggest which classes deviate significantly from symmetry. In particular, pairwise tests indicate which pairs are asymmetric in the NN structure, while one-versus-rest tests indicate which class is asymmetric with respect to the remaining classes. In all the above cases, the post hoc tests can give different and seemingly conflicting results (e.g., one class can be symmetric with respect to the rest and at the same time it can be asymmetric with respect to one of the other classes). Even if the pairwise symmetry tests are used, the restricted or unrestricted versions might yield different results. So extra care should be exercised for which post hoc test is used and how it should be interpreted.

Example Data: Lansing Woods Data
To illustrate the methodology, we use the Lansing Woods data, which contains locations of trees (in feet (ft)) and botanical classification of trees (according to their species) in a 924 ft × 924 ft (19.6 acre) plot in Lansing Woods, Clinton County, MI, USA [26]. The data set is available in the spatstat package in [25] and comprise of 2251 trees together with their species as hickories, maples, red oaks, white oaks, black oaks, and miscellaneous trees. In our analysis, we only consider the black oaks, maples, and white oaks which constitute a total of 1097 trees. The scatter plot of these tree locations are presented in Figure 1.

Overall Symmetry Analysis.
The NNCT for this data set is presented in Table 13. Notice that the off-diagonal entries (i.e., and values with ̸ = ) are very similar for = 1, = 2 and = 1, = 3, indicating symmetry in the mixed NN structure for black oaks versus maples and black oaks versus white oaks. But 23 and 32 values seem to be very different suggesting strong asymmetry in mixed NN structure for maples versus white oaks. We will be formally testing symmetry and attaching significance to it later in this section.
The (reduced) -symmetry contingency table is presented in Table 14, where the relative frequencies with respect to row sums are provided in parentheses. Observe that the column relative frequencies (i.e., column sums divided by the grand sum or the overall ratios of shared NNs for 0, 1, and ≥2 shared NNs) are 0.27, 0.50, and 0.24. The ratios of shared NNs for black oaks (i.e., the row entries for black oaks divided by the row sum for black oaks) are 0.27, 0.50, and 0.23, the ratios for maple trees are 0.22, 0.50, and 0.28, and the ratios for white  We present the test statistics and the associated values for the overall symmetry analysis in Table 15, where X 2 , X 2 I , and X 2 II are as defined in the text, and the superscript stands for "uncorrected for continuity" or "no Yates correction. "    Table 13 and the test statistic in (16). For the unrestricted pairwise tests for Pielou's second type of symmetry test for species and , we use the 2 × 3 -symmetry contingency table which is obtained by using rows and in Table 14.
We present the test statistics and the associated values for the unrestricted pairwise symmetry tests in Table 16. Notice that asy and rand are very different for Pielou's first type of symmetry test with and without Yates correction and very similar for other tests. The test statistics and the corresponding values imply that there is symmetry in NN structure for black oaks versus maples and for black oaks versus white oaks. However, maples versus white oaks exhibit significant asymmetry in NN structure.

Restricted Pairwise Symmetry Analysis.
For the restricted pairwise symmetry tests, we construct the contingency tables for the two species in question (ignoring the other species). The NNCTs for the three pairs of species are presented in Table 17. Notice that the off-diagonal entries are very similar for black oaks versus maples and black oaks versus white oaks, indicating symmetry in the mixed NN structure for these pairs of species. The off-diagonal entries are very different for maples versus white oaks indicating strong asymmetry in mixed NN structure for these species.
The (reduced) -symmetry contingency tables for each pair of species in the restricted sense are presented in Table  18, where relative frequencies of cell counts with respect to row sums are presented in parentheses. Relative frequencies of black oaks and maples seem to be very similar to the overall frequencies for the column sums, and the same holds for black oaks and white oaks, indicating symmetry in the shared NN structure. On the other hand, the relative frequencies for the maples and white oaks seem to be different from the overall frequencies, indicating asymmetry in the shared NN structure. We present the test statistics and the associated values for the restricted pairwise symmetry analysis in Table 19. Black oaks versus maples exhibit symmetry in the NN structures and likewise for black oaks versus white oaks. However, maples versus white oaks exhibit significant asymmetry in the NN structures.

One-versus-Rest Symmetry Analysis.
For the oneversus-rest type symmetry tests, we construct the contingency tables for each species in question pooling the other species in one class. The NNCTs for the three species are presented in Table 20. Notice that the off-diagonal entries are very similar for black oaks versus rest, indicating symmetry in mixed NN structure. The off-diagonal entries for maples versus rest and white oaks versus rest are very different suggesting asymmetry in mixed NN structure.
The (reduced) -symmetry contingency tables for each species in the one-versus-rest sense are presented in Table 21 which also contains the relative frequencies with respect to row sums in parentheses. The relative frequencies for black oaks versus rest are similar to the overall frequencies indicating symmetry in the shared NN structure, while they are different for maples versus rest and white oaks versus rest, indicating asymmetry in the shared NN structure.
We present the test statistics and the associated values for the one-versus-rest symmetry analysis in Table 22. There is symmetry in NN structures for black oaks versus rest, while
We focus on dissimilarity measures only, since any similarity measure can easily be converted to a dissimilarity measure [27]. Any distance metric is by definition a dissimilarity measure. In practice, the term distance is often used to describe precisely the differences of actual measurements, while "dissimilarity" might be an estimation of a distance we can not measure physically. Among the widely used distances are Euclidean, Minkowski, Mahalanobis, and taxicab distances; among the nonmetric dissimilarity measures are maximum coordinate difference, minimum coordinate difference, dot product, Pearson's linear dissimilarity, and Spearman's rank dissimilarity.
In the literature usually NN relationships defined with distance metrics are used. In particular, Euclidean distance in R 2 is the only metric used in this paper. The use of distances for obtaining the NN relations can be generalized to dissimilarity measures in such a way that the NN of an object, , refers to the object with the minimum dissimilarity to . We assume that the objects (events) lie in a finite or infinite dimensional space satisfying the symmetry conditions. Under RL, the objects are fixed in the sense that they yield fixed interpoint dissimilarity measures, but the labels are assigned randomly.
The spatial patterns have broader interpretations in this extension. Symmetry occurs when the classes have similar NN structures with respect to each other. The extension of Pielou's first type of symmetry test is straightforward.  However, Pielou's second type of symmetry test and Dixon's tests are constructed assuming that data are in R 2 in the literature. In Dixon's tests, the term which is the number of points with shared NNs needs to be updated for higher dimensional data. The general form of is defined as̃:= 2 ∑ =1 ( 2 ) . In practice, usuallỹ≈ . One may check the appropriateness of this assumption by using the interpoint The Scientific World Journal 21 dissimilarity matrix in the classical multidimensional scaling of the data to R 2 . If the NN relations do not change considerably, it might be more practical to just use instead of̃for computational reasons. Furthermore, with non-Euclidean distances or dissimilarity measures, a point can serve as a NN to more than 6 points, so the -symmetry contingency table should be updated accordingly.
Here is a possible example for which we have dissimilarity measures between objects that lie in a high or infinite dimensional space. In medical image analysis the differences in morphometry (shape and size) of tissues are measured by a distance metric called LDDMM (see, e.g., [28]). Based on the distances measured between certain brain tissues (like hippocampus), one is interested, say, in the symmetry of the shapes of the tissues with respect to NN relationships. This aspect of spatial dependence in the (abstract) morphometric space is a topic of prospective research.

Discussion and Conclusions
In this paper, we investigate tests of symmetry in mixed and shared nearest neighbor (NN) structures using contingency tables based on the NN relations between classes. We consider Pielou's two types of symmetry tests and Dixon's symmetry test and determine their appropriate null hypotheses and the underlying assumptions. Pielou's first type of symmetry test and Dixon's symmetry tests are for symmetry in mixed NN structure and are based on the nearest neighbor contingency table (NNCT), while Pielou's second type of symmetry test is for symmetry in shared NN structure and is based on thesymmetry contingency table. We derive the asymptotic distribution of Dixon's symmetry test under RL, which is also valid under CSR independence conditional on spatial allocation of the points in the study region. We extend Pielou's and Dixon's symmetry tests to multiclass case and prove the consistency of these tests under their appropriate null hypotheses. In particular, we prove consistency for Pielou's first type of symmetry test under the appropriate sparse sampling in the overall multinomial framework, for Pielou's second type of symmetry test under the appropriate sparse sampling in the row-wise multinomial framework and for Dixon's symmetry test under RL patterns with completely mapped data.
Among the symmetry tests, we demonstrate that versions of Pielou's first type of symmetry test are extremely conservative when used with the asymptotic critical value for the McNemar's test, due to dependence between base-NN pairs and the underlying framework for the NNCT. Hence, these tests should be avoided in practice with the asymptotic critical values but can be used with Monte Carlo randomization. On the other hand, Pielou's second type of symmetry test and Dixon's symmetry test are about the desired level under complete spatial randomness (CSR) independence and random labeling (RL). We also consider the use of Fisher's exact test for the -symmetry contingency table. In particular, we demonstrate that the table exclusive version of the twosided exact test has the desired level under CSR independence and RL. It is also desirable for a test not only to be consistent but also powerful; hence, determining appropriate alternatives for these tests is an important task. We consider various patterns for assessing the finite sample performance of symmetry tests and discover other patterns under which the null hypotheses for these types of symmetry tests are satisfied. However, the variances and covariances (and hence the asymptotic distributions) should be adjusted to have the desired level for these patterns, because the asymptotic distribution of Dixon's symmetry test is only derived under CSR independence and RL. With the critical values based on the asymptotic distribution under CSR independence or RL, the tests are either extremely conservative or liberal (although the null hypotheses are satisfied). We also find that some of the patterns can serve as alternatives for symmetry in shared NN structure or for symmetry in mixed NN structure. Under these alternatives, we observe that Pielou's second type of symmetry test has higher power compared to Dixon's test of symmetry. Furthermore, Pielou's second type of symmetry test is only empirically shown to be appropriate under CSR independence and RL by Monte Carlo simulations. Finding the distribution of Dixon's symmetry test under the null hypothesis of symmetry in mixed NN structure in general (as CSR independence and RL are only two special cases in this setting) and finding the distribution of Pielou's second type of symmetry under the null hypothesis of symmetry in shared NN structure (even under CSR independence or RL) are still open problems.
In a multiclass setting, first an overall symmetry test can be conducted as an omnibus test. If significant, then either one-versus-rest or pairwise type post hoc tests can be applied. If the interest is in the symmetry of one class with respect to the remaining classes, then a one-versus-rest type analysis should be performed. On the other hand, if the interest is in determining which pair(s) significantly deviate from symmetry, then pairwise symmetry tests can be employed. When we are doing the pairwise tests after an overall symmetry test, we recommend the unrestricted pairwise version, which takes all the data into account (indeed the significant overall test was based on all the data considered). But if the interest is only on two of the classes, then a restricted pairwise test (considering only the classes in question) can be employed. For symmetry in shared NN structure (with -symmetry contingency table), we recommend the use of one-versusrest type post hoc tests, as they are more consistent with the overall symmetry test.
Throughout the paper, we assumed that the total sample size is a fixed quantity. To make it a random variable, one may consider that data are from a Poisson point process over the (bounded) region of interest. The generalizations of the tests to high dimensional data and NNCTs based on general dissimilarity measures make this methodology useful for other fields as well.
Finally, the tests in this paper are not adjusted for the influence of the edges or boundary of the support, which usually causes the tests to be slightly liberal or conservative. Such an adjustment is only necessary when the spatial allocation of the points is not fixed but results from a stochastic process whose support contains the study region (as in the CSR independence case). To make the size of the test appropriate, the tests need to be adjusted for boundary effects, which is also a topic of prospective research.