Privacy-preserving chi-squared test of independence for small samples

Background The importance of privacy protection in analyses of personal data, such as genome-wide association studies (GWAS), has grown in recent years. GWAS focuses on identifying single-nucleotide polymorphisms (SNPs) associated with certain diseases such as cancer and diabetes, and the chi-squared (χ2) hypothesis test of independence can be utilized for this identification. However, recent studies have shown that publishing the results of χ2 tests of SNPs or personal data could lead to privacy violations. Several studies have proposed anonymization methods for χ2 testing with ε-differential privacy, which is the cryptographic community’s de facto privacy metric. However, existing methods can only be applied to 2×2 or 2×3 contingency tables, otherwise their accuracy is low for small numbers of samples. It is difficult to collect numerous high-sensitive samples in many cases such as COVID-19 analysis in its early propagation stage. Results We propose a novel anonymization method (RandChiDist), which anonymizes χ2 testing for small samples. We prove that RandChiDist satisfies differential privacy. We also experimentally evaluate its analysis using synthetic datasets and real two genomic datasets. RandChiDist achieved the least number of Type II errors among existing and baseline methods that can control the ratio of Type I errors. Conclusions We propose a new differentially private method, named RandChiDist, for anonymizing χ2 values for an I×J contingency table with a small number of samples. The experimental results show that RandChiDist outperforms existing methods for small numbers of samples.


Introduction
Examining genes involves comparing several groups of genes [1,2], with three or more groups possibly involved in several instances. Generally, statistical analyses such as the chi-squared (χ 2 ) test of independence are used to determine whether single-nucleotide polymorphisms (SNPs) can be considered significantly different. The findings from such analyses are frequently shared between researchers and government agencies to facilitate new discoveries.
A genome can contain sensitive information about an individual such as genetic disease factors and disease risk. Each person's genome is 99.9% identical, with the remaining 0.1% difference producing peoples' various characteristics. The variation among individuals at a single position in a genome is known as a SNP. A genome-wide association study (GWAS) is a method of analyzing the statistical relationship between SNPs and diseases by finding SNPs that are related to a specific disease. To accomplish this, χ 2 testing has been used. Homer et al. [3] reported that an attacker may be able to statistically determine whether someone is a member of a group with a specific disease if the attacker is familiar with the potential victim's SNPs and the aggregate allele frequencies within that specific disease group.
The underlying assumption that the attacker is familiar with the potential victim's SNPs, which can be obtained from a very small blood sample, is realistic because of the increasing availability in cost-effective genotyping services [4,5]. Furthermore, Wang et al. [6] suggested that the allele frequency of the group SNP values can be determined from standard statistical data such as p-values or χ 2 values. Consequently, an anonymization procedure should always be applied to χ 2 values when publishing SNP datasets [6][7][8].
Data sharing in genemic research is very important [9]. To avoid such leakage of private information, we should execute a privacy protection mechanism on GWAS results. Existing studies add a relatively large amount of noise to GWAS results to protect privacy. However, our aim is to reduce the amount of noise while maintaining the same level of privacy protection. In other words, we can achieve the same level of privacy protection as existing studies with privacy-preserving χ 2 testing and increase the usefulness of GWAS results.
The recent GWAS analysis methods are not limited to only the chi-squared test. For example, mixed linear model based methods have been used. However, the chi-squared test is still an important analysis method.
Although other methods for GWAS exist, a lot of recent research papers employ the chi-squared test for GWAS, such as [10][11][12][13], which were published in 2019 or 2020. Furthermore, the chi-squared test is used in numerous papers on GWAS to analyze COVID-19 [14][15][16][17][18]. Thus, because the chi-squared test has been adopted in many cases, it is worth studying.
Other tests, such as Kruskal-Wallis test and Wilcoxon test, are also employed for GWAS [19,20]. Couch et al. [21] proposed differentially private methods for these tests. Dealing with other tests in our research remains an issue to be addressed in future work.
The most influential privacy metric within the privacy community is -differential privacy [22], which has been intensively investigated [23][24][25][26]. Several researchers, such as Fienberg et al. [27], Uhlerop et al. [28], and Yu et al. [7], have suggested approaches to facilitate sharing of χ 2 values while conforming with -differential privacy parameters. However, these proposed methods are currently only applicable to 2 × 2 or 2 × 3 contingency tables. In other words, it is currently not possible to analyze contingency tables larger than 2×3. However, the requirement to analyze SNPs based on an I ×J contingency table is crucial. For example, previous studies have evaluated higher degrees of freedom within a contingency table [8,29]. However, these methods have relatively poor accuracy, particularly in cases with small sample populations. This condition applies to many situations where the sample sizes being considered can range from dozens to several hundred samples [30][31][32].
Although we live in an era of big data where datasets with a large number of samples are becoming available in many domains, obtaining sensitive information is still difficult due to privacy regulations such as General Data Protection Regulations (GDPR). Sensitive patient biomedical data cannot be shared without permission [33]. Moreover, there are a lot of rare diseases, and obtaining such information of the patients is very difficult [34,35]. Further, it is difficult to collect a large number of samples when there is a need for rapid analysis for a new disease such as COVID-19. Someone might provide his or her sensitive information without any privatization schemes; however, more people would provide their sensitive information by conducting privatization schemes [36,37]. Moreover, many studies [38][39][40] have considered contingency tables larger than 2×3. Therefore, private χ 2 testing for large contingency tables with small samples is an important problem.
In this paper, we propose a new method, named RandChiDist, for anonymizing χ 2 values for an I × J contingency table with a small number of samples, and we experimentally evaluate this method using real datasets. RandChiDist adds the minimized Laplace noise to the true χ 2 value based on the contingency table and controls the ratio of Type I errors (i.e., false positives). The evaluation uses the synthetic and real datasets, including two genomic datasets. The evaluation shows that RandChiDist can control the ratio of Type I errors strictly and can reduce Type II errors (i.e., false negatives) more than existing methods that can control the ratio of Type I errors. Several methods reduce Type II errors more than RandChiDist; however, the methods cannot control the ratio of Type I errors.
Several approaches exist for non-private χ 2 testing, and RandChiDist can be used to calculate the global sensitivity of the χ 2 value of the simplest χ 2 testing and to add noise to the χ 2 value based on the global sensitivity. Thus, the added noise is minimized according to the Laplace mechanism theorem [22].
The motivation of this paper is summarized as follows. Chi-squared test can be employed for various data analyses, such as the identification of SNPs associated with certain diseases; however, publishing the chi-squared value can lead to privacy leakage. Thus, we propose a privacy-preserving chi-squared testing algorithm for a small number of samples due to the difficulty in collecting a large number of samples of a rare disease or new disease.
In our research, samples of less than about 1,000 in number are considered as a small sample size.
The rest of this paper is organized as follows: "Preliminaries" section introduces χ 2 hypothesis test and differential privacy. "Related work" section discusses related work. "Proposed method" section presents our proposed method and "Evaluation" section presents the results of our simulations. "Discussion" Section discusses the evaluation results, and the need for adaptation to a large contingency table and a small sample. "Conclusion" section concludes the paper.

Preliminaries χ 2 hypothesis test of Independence
We consider a contingency table with I rows and J columns. Let [ i, j] denote the ith row and jth column's cell of the table. O i,j represents the value of cell [ i, j], and E i,j represents the expected value of cell [ i, j].
Let m i = j O i,j , s j = i O i,j , and n = i m i = j s j . Table 1 provides an example of a contingency table.
The χ 2 value is calculated as We determine the significance level α (i.e., the probability of a Type I error occurring) and the null hypothesis H 0 in advance. We then calculate χ 2 based on Eq. (1) and determine whether to reject H 0 using the χ 2 distribution table. Thus, χ 2 v represents the probability density function of the χ 2 distribution with v degrees of freedom. The χ 2 distribution table presents the percentage point P(χ 2 v > x) = α for several combinations of v and α.
The privacy parameter reflects the privacy level, with a large value indicating a low privacy. We consider neighboring databases to represent two databases differing by a maximum of one record. The -differential privacy is defined as follows: Definition 1 ( -differential privacy) Let D and D be neighboring databases. A randomized mechanism M satisfies the -differential privacy if, for any D and D and any subset of outputs Y ⊂ Range(M), it holds that The Laplace mechanism, which adds noise generated using a Laplace distribution, can satisfy Theorem 1 [22]. To explain this mechanism, we first outline the concept of global sensitivity.
the global sensitivity of f is f .

Related work
In χ 2 testing, a contingency table such as Table 2 is used. This contingency table can be represented as Table 3, and Tables 2 and 3 are equivalent. In research on privacypreserving χ 2 testing, databases such as those shown in Table 3 are considered. For example, Tables 3 and 4 are neighboring databases because the tables contain the same data with exception of one record Yu et al. [7] demonstrated that the global sensitivity of the χ 2 value of 2 × 3 contingency tables can be calculated as if m 1 and m 2 are known (i.e., published). Fienberg et al. [27] and Uhlerop et al. [28] demonstrated that if m 1 = m 2 , the global sensitivity of the χ 2 value can be calculated as The global sensitivities, F and Y , have been shown to be optimal values. However, they can only be applied to 2 × 2 or 2 × 3 contingency tables.
Kakizaki et al. [44,45] proposed a unit circle mechanism that can achieve a high degree of accuracy. However, they assumed only 2 × 2 contingency tables. Additionally, they did not publish the differentially private χ 2 value used in their method; however, they did publish the differentially private result of the χ 2 testing based on the given significance level, α. Therefore, if a data holder wants to publish the private χ 2 testing results of several α values (e.g., α = 0.05, 0.01, 0.005, and 0.001), the data holder must independently execute the privacy mechanisms multiple times (e.g., three times). Following the composition theorem [46], if a privacy mechanism outputs K times based on -differential privacy, the resulting privacy level thus becomes K (i.e., the privacy level decreases). Moreover, Banerjee et al. [47] state that publishing P-value could be important for data analysis.
The aforementioned studies all assumed that m i (i = 1, . . . , I) is not sensitive information. We can share each value of m i without privatization schemes.
Gaboardi et al. [8] proposed several methods for arbitrary contingency tables. First, they show a straightforward method that does not add Laplace noise to the χ 2 value, but rather adds it to each cell of the contingency table with a global sensitivity of 2.

2&1
In this paper, we name this method as RandCell. RandCell is also known as SNPpval, which was proposed by Jonson and Shmatikov [48]. The χ 2 value of the contingency table to which RandCell adds Laplace noise tends to be large, meaning that RandCell yields many false positives. Therefore, Gaboardi et al. proposed several other methods known as PrivIndep, MCIndep with Laplace mechanism, and MCIndep with Gaussian mechanism. They showed that MCIndep with Laplace mechanism had the best performance of their proposed methods. Hence, we describe MCIndep with Laplace mechanism in detail in this paper and refer to MCIndep with Laplace mechanism as MCIndep for simplicity.
MCIndep generates many contingency tables randomly based on m i and s j of the contingency table with added Laplace noise and compares their χ 2 values. The original contingency table can be considered to reject H 0 if the χ 2 value of the contingency table to which RandCell adds Laplace noise is greater than the top α × 100% of the generated contingency tables' χ 2 value. Other methods for ( , δ)-differential privacy are proposed [49], which relaxes the -differential privacy as their privacy metric. We focus on -differential privacy in this paper, and applying our method to ( , δ)-differential privacy is an issue to be addressed in future work.
Sei et al. [50] proposed several theorems for differentially private χ 2 testing, but there were no detailed proofs for the theorems and the equations provided in their study. Moreover, there were no experiments that evaluated the performance of χ 2 testing.
More recently, Gaboardi et al. [29] proposed χ 2 test algorithms (LocalNoiseIND, Local-ExpIND, and LocalBitFlipIND) for privacy-preserving χ 2 testing of independence based on local differential privacy. LocalNoiseIND is also known as zCDP general chi-squared test, which was proposed by Kifer and Rogers [51]. In their paper, they showed that Local-ExpIND had the best performance of the three methods for most parameter settings. These methods can be applied to arbitrary contingency tables, and address a local model of privacy and assume there is no trusted entity. In this paper, we assume that a trusted entity has all the raw data.
Canonne et al. [52] calculated the sample complexity bounds of an -differentially private test for distinguishing between two distributions. They also applied differentially private change-point detection. Their method is for a parametric setting that requires that the two distributions are perfectly known. In contrast, our method can be used for a nonparametric setting.
Csail et al. [53] proposed an algorithm for testing the closeness of two distributions in a private manner. Their algorithm can also test the independence of two random variables. However, execution for privacy-preserving χ 2 testing was not described.
Liu et al. [54] showed how influences the accuracy of differentially private hypothesis testing. They proposed a method to determine an appropriate value for that can be useful for determining the value for our proposed algorithm; however, determining is outside the scope of our paper.
Couch et al. [21] proposed a differentially private hypothesis testing method for the Kruskal-Wallis test, Mann-Whitney test, Wilcoxon test, and one-sample t-test. This hypothesis testing method is not for nominal scale data, which are suitable for χ 2 testing, but rather for ordinal or interval scale data.
The methods for arbitrary I × J contingency tables have relatively poor accuracy, particularly in cases with small-sample populations. We show the comparison between existing methods and the proposed method in "Evaluation" section.

Adversarial model
The adversarial model is described as follows. The server has a database, and it wants to share the result of the chi-squared test with data analysts who are potential attackers. The attacker is considered to be a semi-honest entity, that is, the attacker follows the protocol between the server. However, the attacker might attempt to extract individual information from the result of the chi-squared test.

Overview
We propose RandChiDist, which adds Laplace noise to the χ 2 value obtained from a target contingency table. Calculating the Laplace noise to be added requires the global sensitivity of the I × J contingency table's χ 2 value. The method for calculating global sensitivity is described in 1.
Typically, the χ 2 distribution table is used to determine whether to reject H 0 . However, RandChiDist adds noise to the χ 2 value, thus we need a modified χ 2 distribution table. The method for calculating this is described in 1. RandChiDist uses this table to determine whether to reject H 0 . We consider bounding the Type I error to be at most α to be a hard constraint.
Our main symbols are summarized in Table 5.

Global sensitivity of χ 2 value
As was assumed in other studies, we assume that m i (i = 1, . . . , I) is also provided to a data analyzer. We consider contingency tables D 1 and D 2 , which are generated from neighboring databases. Because the neighboring databases differ by one record, their contingency tables differ by a maximum of two cells.
Because the values of m i (i = 1, . . . , I) are released to the public, the collection of databases in Definition 2.2 only include databases that satisfy the released values of m i , and the neighboring databases are elements of the collection. Therefore, the global sensitivity is calculated based on the neighboring databases that satisfy the released values of m i . Thus, we calculate the possible maximum value of the difference of χ 2 values between tables D 1 and D 2 .
RandChiDist satisfies differential privacy by adding Laplace noise with global sensitivity because of Theorem 1. We thus propose RandChiDist, which adds Laplace noise with global sensitivity, where α = arg min i m i and to the calculated χ 2 value from (1). Here, we have the following theorem: Theorem 2 RandChiDist satisfies -differential privacy.
Proof We prove that R is the global sensitivity of χ 2 of the I × J contingency table. We can then uphold Theorem 2 because RandChiDist adds Lap( R / ) to the original value based on the Laplace mechanism theorem (Theorem 1).
Let O i,j (D) denote the observed value of cell [ i, j] in database D and let χ 2 (D) denote the χ 2 value of database D. Without a loss of generality, we consider neighboring databases D 1 and D 2 , which satisfy the following equations: where k and l are arbitrary natural numbers satisfying k, l ∈ {1, . . . , J} and k = l. From Proposition 2, when J is greater than or equal to 3 and we are given the value a, neighboring databases that satisfy the following constraints maximize the difference between the χ 2 values of tables D 1 and D 2 (see Fig. 1a).  From constraint (9), we understand that the sum of the kth column of D 2 (i.e., s k of D 2 ) is equal to m a . Let The symbol b is an arbitrary integer from 1 to I but not a. The symbol l is an arbitrary integer from 1 to J but not k.
The difference between the χ 2 values of tables D 1 and D 2 that satisfies the constraint (9) is thus calculated by Therefore, given a, when the value of J is greater than or equal to 3, global sensitivity is represented by Eq. (10). Moreover, from Proposition 1, global sensitivity is represented by Eq. (6) when the value of J is greater than or equal to 3 and a is not given.
When J = 2 and a is given, neighboring databases that satisfy the following constraints will maximize the difference between the χ 2 values of contingency tables D 1 and D 2 from Proposition 3 (see Fig. 1b).
The difference between the χ 2 values of tables D 1 and D 2 that satisfy the constraint (11) can be calculated as Because n 2 /(m a (n − m a + 1)) decreases when m a decreases, the global sensitivity can be represented by Eq. (6) when J is equal to 2 and a is not given.
When we use a 2 × 3 contingency table, R is identical to Y , and when we use a 2 × 3 contingency table with m 1 = m 2 , R is identical F . Propositions 1 and 2 used in the proof of Theorem 2 are described below. (7) are satisfied.

Proposition 1 R in Eq. (6) is maximized when the minima
Proof By differentiating Eq. (6) with respect to m a , we obtain By differentiating Eq. (6) with respect to m b , we obtain From Expressions (13) and (14), m a and m b should thus be minimized to maximize Eq. (6).
Let min denote the minimum value in m i (i = 1, . . . , I) and let min+x denote the second most minimum value in m i (i = 1, . . . , I), where x ≥ 0. If m a is min and m b is min + x, Eq. (6) can then be expressed as If m a is min + x and m b is min, Eq. (6) can then be expressed as Because Expression (15) is always greater than or equal to Expression (16), we find that the value of R in Eq. (6) is maximized when (7) is satisfied.

Proposition 2
When J is greater than or equal to 3 and a is given, neighboring databases that satisfy the constraints (9) maximize the difference between the χ 2 values of tables D 1 and D 2 .
Proof There are many neighboring databases that satisfy Eq. (8); however, we prove that neighboring databases that satisfy the constraints (9) have the greatest difference, δ(D 1 , D 2 ), between χ 2 (D 1 ) and χ 2 (D 2 ) when J ≥ 3. We assume that m i is a fixed value for all values of i.
Thus, we write O i,j (D 1 ) as O i,j for any i and j in the following manner. Following Lemma 1, O a,k should be maximized to maximize δ(D 1 , D 2 ). As a result, the value of O a,k becomes m a − 1 because of the constraints (17).
From Eq. (8) we have the following constraints: As a result, we can maximize δ(D 1 , D 2 ) when tables D 1 and D 2 satisfy the constraints (9) by replacing μ in Lemma 4 with b. maximize δ(D 1 , D 2 ), O a,k should be maximized (and correspondingly, O a,r for all r, except for r = k, l, should be adjusted to satisfy m a ).

Lemma 1 To
By differentiating Eq. (18) with respect to O a,k , we obtain because we have Expression (23) is always greater than zero. When = 0 in Expression (21), the value of Expression (21) is less than 0. Thus, when is less than Expression (23), Expression (21) is less than zero. Similarly, when is greater than Expression (23), Expression (21) In contrast, when By subtracting Expression (25) from Expression (24), we obtain Because Expression (26) is always greater than zero, O i,k for all i except i = a should be zero.

Lemma 3 To maximize δ(D 1 , D 2 ), O a,l should be minimized (and correspondingly O a,r for all r except r = k, l should be adjusted to satisfy m a ).
Proof By differentiating Eq. (18) with respect to O a,l , we obtain because we have ∂s l ∂O a,l = 1.
Because (27) Expression (31) is always greater than zero. When = 0 and O a,l = 1 in Expression (29), (29) can be expressed as Therefore, when is less than or equal to Expression (31), Expression (29) is greater than zero, and when is greater than Expression (31), Expression (29) is less than zero. Thus, to maximize Eq. (18), the value of O μ,l should be either minimized (i.e., zero) or maximized (i.e., m μ ).
Thus, to maximize δ(D 1 , D 2 ), the value of O μ,l should be either minimized or maximized. Let us have In contrast, when O μ,l is minimized (i.e., O μ, By subtracting Expression (34) from Expression (33), we obtain When I = 2, the second term of Expression (35) is zero. Therefore, Expression (35) is always greater than zero and Lemma 4 holds when I = 2.
We then consider the situation where I ≥ 3. We assume that O i,l is zero for all values of i except i = a and i = μ. In this case the second term of Expression (35) is zero and the first term of Expression (35) is greater than zero; therefore, we can say that Expression (35) is always greater than zero. Thus, O μ,l should be maximized to m μ when O i,l is zero for all values of i except i = a and i = μ.
Next, we focus on v such that v ∈ {1, . . . , I} and v = a, μ. We demonstrate that Expression (35) is always ≤ 0 when O v,l is maximized to m v . Additionally, the second term of Expression (35) is minimized when I = 3. In this case, we obtain because x = m v + 1. Therefore, each O i,l for all i except i = a, μ should be minimized to zero. From this observation, Lemma 4 also holds when I ≥ 3.

Proposition 3 When J equals 2 and a is given, neighboring databases that satisfy the constraints (11) maximize the difference between the χ 2 values of tables D 1 and D 2 .
The proof can be conducted in a similar manner as Lemma 2.

Differentially private hypothesis testing
We can now calculate the anonymized χ 2 value from an original table, where χ 2 * is the anonymized χ 2 value. From the definitions of the Laplace distribution and χ 2 distribution, the probability density function of a χ 2 value possessing v degrees of freedom with the addition of Laplace noise and global sensitivity can be expressed as where and where (v/2) represents the v/2 gamma function, that is, When we set the significance level to α, our proposed RandChiDist rejects H 0 if the χ 2 value calculated using Eq. (1), with the addition of Laplace noise and the scale R / , is greater than or equal to α, as calculated by solving the following equation with regard to α; Lastly, we compare the χ 2 * value calculated using Eq. (37) to the t value calculated using Eq. (43). When χ 2 * is greater than or equal to t, RandChiDist outputs "reject the null hypothesis H 0 , " and otherwise outputs "fail to reject the null hypothesis H 0 . " Algorithm 1 shows the overall RandChiDist algorithm. Return "reject the null hypothesis H 0 " 7: else 8: Return "fail to reject the null hypothesis H 0 " 9: end if

Algorithm 1 Algorithm of RandChiDist
If we want an anonymized version of the p value, RandChiDist calculates and outputs The data analysis can thus conduct a χ 2 hypothesis test using an arbitrary α by comparing Expression (44) and α.

Complexity analysis
Calculating original χ 2 yields a computational complexity of O(I × J). Calculating global sensitivity R requires finding the largest value and the second largest value of m i (i = 1, . . . , I); therefore, the computational complexity is O(I). Calculating (43) and (44) requires the calculation of an integration. For example, Monte Carlo integration can be adopted to calculate an integration. The computational complexity of Monte Carlo integration is not influenced by the cross table. There are numerous Monte Carlo integration methods that can be calculated extremely fast [55]. Therefore, the computational complexity of the proposed algorithm is O(I × J + M), where M denotes the computational complexity of calculating an integration.
LocalExpIND was proposed especially for local privacy; therefore, LocalExpIND can be used for more scenarios than RandChiDist. Thus, the local model of privacy is another avenue for future exploration.
Moreover, to clarify the contribution of calculating the private χ 2 distribution table's value (proposed in "Differentially private hypothesis testing" section), we also compared a method that uses the global sensitivity R calculated using Eq. (6) that does not use the private χ 2 distribution table's value calculated using Eq. (24). We refer to this method as RandChi, which is also proposed in this paper.
The source code for the RandChi and RandChiDist methods can be obtained from https://uecdisk.cc.uec.ac.jp/index.php/s/pic3T9GEp03qy6y.
We should use Bonferroni's corrected threshold when conducting multiple χ 2 testing [56]. In this paper, we conducted many χ 2 tests; however, we consider each to be independent. Thus, Bonferroni's corrected threshold was not used in this paper to compare the performance among our proposed methods and methods from existing studies for independent χ 2 testing. This paper shows the average results of each independent χ 2 test. Additionally, previous studies of privacy-preserving χ 2 testing, such as [7, 8, 27-29, 44, 45], did not use the Bonferroni's corrected threshold.
We varied the values of n from 100 to 900, α from 0.005 to 0.05, and from 0.01 to 10. We set the parameters of MCIndep the same as in [8].

Significance results
We first evaluated the significance to confirm that RandChiDist guarantees a significance of at least 1 − α. We randomly generated 2 × 2 contingency tables based on a multinomial distribution with probabilities of (0.25, 0.25, 0.25, 0.25) 1,000 times. Each time, we evaluated whether each method correctly output "fail to reject the null hypothesis H 0 . " Figure 2 shows the results with an value of 0.1. The significance of each method should be approximately 1 − α.
The significance levels of RandChiDist, MCIndep, and LocalExpIND were controlled around 1−α for any n, , and α values. In contrast, RandCell and RandChi had significance values much less than 1 − α when was less than 1.
We conducted the same experiments for randomly generated 4 × 4 contingency tables based on a multinomial distribution with probabilities of 1/16,. . . , 1/16. Figure 3 shows the results with = 0.1. As with the 2 × 2 contingency tables, the significance values of RandChiDist, MCIndep, and LocalExpIND were approximately 1 − α. In contrast, RandCell and RandChi significance values were less than 1 − α, especially when was small.
RandCell adds a Laplace noise to each cell. The probability that at least one Laplace noise becomes very large increases when the number of cells is large. Therefore, RandCell has many false positives (i.e., significance results are small) when contingency tables are large. On the other hand, if the Laplace noise is a large negative value, the cell value with the noise could be less than five (or negative). In this case, RandCell fails to reject the null hypothesis based on the rule of thumb. Therefore, RandCell's results of 4 ×4 tables are smaller than those of 2 ×2 tables only when n is large. RandChi's significance results do not vary greatly by the table size or n. This is because the global sensitivity calculated from Eq. 7 also does not vary greatly by the table size or n.

Power results
We then evaluated each method's power. The values of parameters α, , and n were identical to those in the significance experiments; however, we randomly generated 2×2 contingency tables based on a multinomial distribution with probabilities of (0. 25  In the experiment on a multinomial distribution with probabilities of (0.25+0.01, 0.25− 0.01, 0.25 − 0.01, 0.25 + 0.01), the empirical power of Non-private, which does not consider privacy at all, is very low, which is approximately from 0 to 0.2. Hence, all privacy-preserving algorithms that can control Type I errors do not realize high empirical power, although RandChiDist, which we proposed, is just slightly better than the other algorithms.
In the experiments on other multinomial distributions, MCIndep has relatively low empirical power. MCIndep generated many contingency tables from its algorithm based In hypothesis testing that includes χ 2 testing, we should avoid Type I errors (i.e., false positives). In general, we adjust the Type I error probability by the value of α (e.g., 0.05). Even if the empirical power is high, the algorithm is of no use if the empirical significance is less than 1-α. The empirical power of RandCell and RandChi is greater than that of RandChiDist; however, RandCell and RandChi have empirical significance values much than 1-α. That is, they cannot control Type I errors (false positives) in many cases. Therefore, we can conclude that RandChiDist outperforms RandCell and Rand-Chi. Among RandChiDist, MCIndep, and LocalExpIND, which can control Type I errors, RandChiDist has the highest power.

Results of real datasets
We used two genomic datasets 1 . The first dataset is the Human Genome Diversity Project genotype dataset (HGDP) used by Conrad [57], which consists of 2,834 SNPs and has 1,244 records after the records in which unknown values are eliminated. The other is the International Haplotype Map Project genotype dataset (HapMap) used by [58], which consists of 1,853 SNPs and has 420 complete records.
We randomly generated contingency tables for linkage disequilibrium analysis for each dataset and set the numbers of columns and rows to four. Following the "rule of thumb, " if any values of the created contingency table are less than five, we re-created another contingency table and then conducted normal χ 2 testing on the original contingency tables. We then carried out the privacy-preserving methods. We generated contingency tables and conducted χ 2 testing 100 times, and then calculated the mean results of false positive and false negative rates.
The results for the HGDP genotype and HapMap genotype datasets are shown in Figs. 8 and 9, respectively. RandChiDist outperformed MCIndep and LocalExpIND for most of the parameter settings used in this paper.

Discussion
According to the evaluation results, RandCell and RandChi could not control the ratio of Type I errors-that is, they caused a lot of false positives. On the contrary, RandChiDist, MCIndep, and LocalExpIND could control the ratio of Type I errors. RandChiDist achieved the least number of Type II errors among RandChiDist, MCIndep, and LocalEx-pIND. When testing a hypothesis, data analyzers determine the significance level α (i.e., the ratio of Type I errors) ahead of time. That is, they reject a true null hypothesis with a probability no greater than α. A high false positive rate means that a true null hypothesis is rejected with a probability greater than α, which leads to the false interpretation of datasets. Therefore, if we want to avoid such false interpretations, RandChiDist is the preferred method. There are several approaches for non-private χ 2 testing. The simplest approach is shown in "χ 2 hypothesis test of Independence" section. RandChi and RandChiDist calculate the global sensitivity of the χ 2 value of the simplest chi-squared testing and adds noise based on the global sensitivity to the χ 2 value. Thus, the added noise is minimized following the Laplace mechanism theorem (Theorem 1).
In contrast, RandCell calculates the global sensitivity of each value of each cell and adds noise to each value. The summation of added noises thus become very large. MCIndep takes another approach for calculating non-private χ 2 testing, as shown in "Related work" section. MCIndep first estimates the parameters of the underlying multinomial distribution generating the samples. By the estimated the multinomial distribution, MCIndep generates more than 1/α contingency tables. When the number of samples is small, the estimated parameters of the underlying multinomial distribution have low accuracy. Because of this low accuracy estimation, MCIndep could have low performance when the number of samples is small. LocalExpIND assumes that each piece data is anonymized for each person and that there is no trusted entity. Because noise is added to each data point, the amount of the total noise becomes large. Sharpe claimed that if we can avoid χ 2 hypothesis testing for contingency tables larger than 2×2, doing so is desirable [59]. However, he showed an understanding that in some cases we could not avoid this and also reported that approximately 30% of χ 2 tests are conducted for contingency tables larger than 2×2. This is based on his survey of journals published by the American Psychological Association for 2012, 2013, and early 2014. χ 2 hypothesis testing has been widely used for GWAS as well as many other personal databases [38][39][40]. Moreover, some studies [38][39][40] have considered contingency tables larger than 2×3. Therefore, we consider the application of -differential privacy to χ 2 hypothesis testing for contingency tables larger than 2×3 to be an important issue.
Our proposed method can be used not only GWAS but also other private data analysis for small samples. For example, the characteristics of COVID-19 patients (n=403) (the number of died patients was 100 and the number of recovered patients was 303) were analyzed by χ 2 test with α being 0.05 [60]. Poyiadi  pulmonary embolism and the COVID-19 without acute pulmonary embolism [61]. The number of patients was n=328. They conducted χ 2 test with α being 0.05. The influence on sexual activity for COVID-19 was analyzed by Jacob et al. [62]. The number of samples was 868. As these studies show, there is a high need for testing with a small sample size.
In particular, it is difficult to collect a large number of samples when there is a need for rapid analysis for a new disease such as COVID-19. We assume that the data holder publishes m i as well as the differentially private chisquare value. In general, the information of m i and a sample size is necessary to interpret a chi-square value accurately [63]. For example, even if in the case of trivial differences between two datasets, a very small chi-square value is obtained when every m i is very large [64]. Therefore, m i is very useful information for data analysts.
Publishing m i also provides several other types of information. For example, we know that O i,j for all j are less than or equal to m i . However, we cannot know each value of O i,j , and we cannot know which value is greater (O i,j or O i,j ) for any j or j , even if we know m i and the (differentially private) chi-square value. Our proposed algorithm can protect chi-square values based on differential privacy, and we can ensure that it is impossible to reconstruct the original cross table. To the best of our knowledge, no researchers have claimed that publishing m i could cause privacy issues.
Conclusion χ 2 testing is widely used in GWAS and other types of data analysis. We proposed the RandChiDist method, which anonymizes the χ 2 value of contingency tables. If we have a lot of samples for data analysis, it is easy to conduct statistical analysis precisely. However, obtaining highly sensitive data is quite difficult due to privacy reasons.Existing methods on privacy-preserving χ 2 testing such as MCIndep are a better choice when the number of samples n is large; however, we demonstrated that RandChiDist outperforms existing methods when n is small.
Future work will include evaluating other relevant datasets. We also plan to apply our method to other hypothesis testing methods such as Student's t-test and Fisher's exact test.