Revisiting Differentially Private Hypothesis Tests for Categorical Data
Yue Wang, Jaewoo Lee, Daniel Kifer
Introduction
Hypothesis testing is an important aspect of statistical analysis and data mining. Because of the possibility that the results of an analysis could leak private information (Homer et al. 2008), various research communities such as statistics, official statistics, and computer science have studied how to incorporate statistical disclosure control to prevent such leakage.
A relatively recent development is a computer science privacy definition known as -differential privacy (Dwork et al. 2006). Statistical disclosure control (SDC) techniques that satisfy differential privacy possess a variety of appealing mathematical guarantees on the privacy of individuals in the data. For instance, the output produced by the SDC techniques is randomized and its probability distribution is barely affected by the inclusion of any individual’s record in the data (Dwork et al. 2006). Furthermore, if data records are independent, it limits any Bayesian inference about an individual: the ratio of posterior odds to prior odds is guaranteed to be bounded by (Kifer and Machanavajjhala 2014) where is a privacy parameter. This guarantee even holds if an attacker has access to all but one of the records in the data.
Recent years have seen a rapid development of differentially private SDC techniques for fitting various models to data. However, hypothesis testing is largely unexplored to the extent that existing methods can only be used reliably in rare circumstances. Our paper addresses these limitations, but first let us examine what the difficulties are.
Now let us consider problems raised by earlier applications of differential privacy to hypothesis testing (Johnson and Shmatikov 2013; Uhler et al. 2013; Yu et al. 2014).
Suppose we collected the voter data in Fig. 1. One may be interested in determining if it provides statistical evidence that voting behavior and gender are not independent.
In the classical (non-private) setting, this question is typically answered by performing chi-squared () or likelihood ratio tests (Ferguson 1996) of independence. This would involve computing the or likelihood ratio test statistics and taking advantage of theoretical results stating that for such tables, under the null hypothesis of independence, these test statistics are asymptotically distributed as chi-squared random variables with 1 degree of freedom (Ferguson 1996). The -value is simply the probability that such a chi-squared random variable would be larger than the actual test statistic. For example, the likelihood ratio statistic for Fig. 1a is with a corresponding -value of , which is generally not considered strong enough to rule out independence. Note that exact tests and permutation tests are other alternatives, but our approach to hypothesis testing with differential privacy extends the asymptotic approaches.
To achieve -differential privacy, Johnson and Shmatikov 2013 propose to add independent Laplace noise with density and to each cell of the table. As an example, when we added this noise to Fig. 1a, we obtained Fig. 1b. The next step (Johnson and Shmatikov 2013) is to simply run the noisy table through off-the-shelf statistical software (which is unaware of this added noise). Intuitively, this seems a bit dangerous as the point of hypothesis testing is to determine how an analysis is affected by noise in the observed data. On the other hand, theoretical arguments (Johnson and Shmatikov 2013) showed that test statistics computed from the noisy tables (in place of the original tables) still asymptotically have a chi-squared distribution with 1 degree of freedom. What happens in practice? The -values produced by this method are extremely biased and will often lead to false conclusions. For example, the likelihood ratio statistic computed from the noisy table in Fig. 1b is equal to and off-the-shelf software would return an estimated -value of , which is often considered statistically significant and clearly contradicts the likelihood ratio test on the original data. While this is just one example from one table, our experiments in Section 5.1 empirically confirm this trend. This mismatch between theoretical arguments and empirical results also points out the need for a more reliable privacy-preserving statistical theory.
The unreliability of the algorithm proposed by Johnson and Shmatikov 2013 was noticed by Uhler et al. 2013, they proposed an output perturbation method (Uhler et al. 2013; Yu et al. 2014): compute the chi-squared statistic on the original data (here it is ), determine a quantity called the sensitivity (the worst-case change in chi-squared values due to the alteration of one individual’s data), add Laplace noise with , and then use a different asymptotic distribution for computing the -value. For tables with (as in our example), the sensitivity is at least (achieved by the worst-case tables and with values and , respectively). This noise has standard deviation at least . When such noise is added to the chi-squared statistic of the original table , it completely overwhelms the original value. As a result, Uhler et al. 2013 and Yu et al. 2014 identified special cases where the amount of noise they need to add for privacy can be substantially reduced.
In this paper, similar to Johnson and Shmatikov 2013, we first add noise to the input data before computing the test statistics. However, to get practical tests that work well on small and large datasets, we need to modify the -value computation. First, we show how to appropriately adjust private statistical theory so that asymptotic results become a good approximation of what happens in practice. Then we derive the asymptotic distributions under this modified methodology for likelihood ratio and chi-squared tests for goodness-of-fit, sample proportions, and independence. We use these asymptotic distributions to produce -values. Although more computationally expensive, we provide an extensive experimental evaluation on real datasets that shows our approach provides much more reliable -values. We note that independent work by Gaboardi et al. 2016 considers chi-squared tests under differential privacy. We elaborate on the differences in Section 3 (related work).
We introduce notations and terminologies in Section 2, discuss related work in Section 3, and present our various statistical tests on privacy-enhanced tables in Section 4. Experiments appear in Section 5 and conclusions in Section 6. For completeness, proofs of our results appear in the online appendices.
Preliminaries and Notations
In this section, we introduce notations and review the necessary prerequisites.
Notations such as and indicate one-dimensional tables of counts. The entry of is denoted by .
Similarly, is a two-dimensional table where is the entry. We will use the standard shorthand and , as well as .
The size of a table ( or ) is the sum of its counts.
We consider the following types of statistical hypothesis tests:
Goodness of fit: given a table of size and a probability vector , the null hypothesis is that was sampled from a Multinomial distribution.
Sample proportions: given tables of size and of size , the null hypothesis is that they are samples from the same distribution. That is, Multinomial and Multinomial, for some unknown .
Independence: given a table of size , the null hypothesis is that the rows and columns are independent.
These hypotheses are commonly tested in the following ways:
Compute either the likelihood ratio statistic LR or chi-squared statistic as follows:
where are estimated expected null hypothesis cell counts and is the number of cells in . Under the null hypothesis, the asymptotic distribution of both and is a chi-squared random variable with degrees of freedom. Thus the -value can be approximated as the probability that the chi-squared random variable exceeds the chosen test statistic computed from . Alternatively, we can sample many tables from the Multinomial distribution and compute the test statistic of each one. The -value could then be approximated as the fraction of sampled tables whose test statistic is greater than or equal to the test statistic of the actual table.
Given of size and of size , compute or as follows:
where and are estimated expected null hypothesis cell counts, and is the number of cells in and . Under the null hypothesis, the asymptotic distribution of both and is a chi-squared random variable (r.v.) with degrees of freedom. We approximate the -value as the probability that the chi-squared r.v. exceeds the chosen test statistic computed from and .
Given table with rows and columns, compute LR or as:
where are estimated expected null hypothesis cell counts. Under the null hypothesis, the asymptotic distribution of both and is a chi-squared random variable with degrees of freedom. The -value can be approximated as the probability that the chi-squared random variable exceeds the chosen test statistic computed from .
A low -value (say, 0.01, depending on the application) indicates strong evidence against the null hypothesis while a larger -value indicates absence of evidence. As can be observed from Definitions 1, 2, 3, the likelihood ratio and chi-squared tests are asymptotically equivalent (Ferguson 1996). However, as we explain in Section 4, differences will emerge due to privacy constraints.
2 Review of Differential Privacy
Differential privacy (Dwork et al. 2006) is a set of restrictions on statistical disclosure control algorithms and guarantees that any data associated with an individual will have little impact on the result of the computation.
A randomized algorithm satisfies -differential privacy if for all contingency tables and that are derived from datasets that differ on the value of one record, and for all ,
This definition means that if we modify any arbitrary record before tabulating our data into a table, the probability of generating any output is changed by a factor of at most . When is small (i.e. close to ), the probabilities are barely affected. This severely limits the ability of an attacker to make inferences about any record in the data. For additional interpretations of the privacy guarantees of differential privacy and suggestions for setting the privacy parameter , see Dwork 2006, Kifer and Machanavajjhala 2014 and Machanavajjhala and Kifer 2015.
There are many ways of constructing SDC algorithms that satisfy differential privacy. One of the simplest methods is called the Laplace Mechanism (Dwork et al. 2006). It relies on a concept called sensitivity and adds noise scaled by the sensitivity value.
Let be a function over contingency tables (the output of can be either a scalar or a vector). The sensitivity of , denoted by , is defined as , where the maximum is over all pairs of tables that are derived from datasets differing on the value of one record.
Intuitively, the sensitivity of a function measures the largest possible change that can experience as a result of modifying one record in some underlying dataset.
Given a (vector or scalar valued) function , privacy parameter , contingency table , and upper bound on the sensitivity , the Laplace mechanism adds independent Laplace() random variables (with density ) to each component of .
Related Work
Genome-wide association studies (GWAS) use statistical tests for finding associations between diseases and single-nucleotide polymorphisms (SNPs). The need for privacy became evident after Homer et al. 2008 raised the possibility of identifying individual participants in GWAS based on published SNP data. With GWAS in mind, Johnson and Shmatikov 2013 proposed differentially private algorithms for independence testing (e.g., -tests) using input perturbation as discussed in Example 1.1. This method often produces unreliable conclusions except for extreme data sizes, as noted by Uhler et al. 2013 and our own experiments. Similar types of negative results produced by running off-the-shelf statistical analyses after input perturbation were reported by Vu and Slavkovic 2009 and Fienberg et al. 2010. Thus, Uhler et al. 2013 instead proposed computing the true statistic, adding noise to it, and then adjusting the asymptotic distribution used to compute -values. Their method was limited to contingency tables where each of the 2 columns added up to . Yu et al. 2014 later removed these restrictions but still required the column-sums to be released exactly (i.e., in a non-private way). In both cases, under the null hypothesis of independence, collecting more data will not result in convergence to the non-private analysis over the original data. Independent work by Gaboardi et al. 2016 follow earlier drafts of our work (Wang et al. 2015). They consider chi-squared tests for goodness-of-fit and independence under the differential privacy model and also a weaker model known as approximate differential privacy (Nissim et al. 2007; Machanavajjhala and Kifer 2015). There are several key distinctions between our work. First, we evaluate our methods on a variety of real datasets (they only consider synthetic data). Second, our formalization of a more accurate asymptotic regime provides asymptotic guarantees on the level of our tests. Without such a formalization, Gaboardi et al. 2016 need synthetic data for empirical validation of Type 1 error (we provide such an empirical evaluation for our tests as well). We additionally consider the test of sample proportions and show a modified equivalence between chi-squared tests and likelihood ratio tests under the new asymptotic regime. Finally, our methods work for any -mean finite variance noise distribution that is added to data (we specialize the discussion to Laplace noise, but any such distribution can be used in its place).
In a general setting, Smith 2011 studied statistical estimators that are known to have asymptotically normal distributions and provided differentially-private versions of those estimators that are also asymptotically normal. As with the tests proposed by Johnson and Shmatikov 2013 (discussed in Example 1.1), very large data sizes are needed to observe approximate normality. Differential privacy has also been applied to other statistical tasks such as computing commonly used robust statistical estimators (Dwork and Lei 2009) and computing private M-estimators (Lei 2011). Chaudhuri and Hsu 2012 established a formal connection between differential privacy and robust statistics by deriving convergence rates in terms of a concept called gross error sensitivity. Dwork et al. 2015 presented a framework for controlling the false discovery rate of a large sequence of hypothesis tests. The method relies on injecting noise directly into -values, which removes their guarantee that they must be (approximately) uniformly distributed under the null hypothesis. Specific instantiations of the framework for various statistical tests are not given and its empirical performance is unknown. Wasserman and Zhou 2010 studied rates of convergence between true distributions and differentially private estimates of distributions. They found that the provable convergence rates under differential privacy were often slower than in the non-private case.
Private Hypothesis Testing
We consider the following setting: a data owner has a table of counts (e.g., or ) and obtains noisy tables (e.g., , ) by adding independent -mean noise with finite variance to each table cell. The table size , the density function of the noise, and the noisy tables themselves are publicly released. If the noise follows a Laplace distribution, then this output satisfies -differential privacy. Our goal is to conduct goodness-of-fit, sample proportions, and independence tests using such noisy data. We feel this is a natural setting as such releases of noisy counts do not force the end-users into any particular analysis task. We first justify our chosen asymptotic regime (Section 4.1), present the modified equivalence between chi-squared and likelihood ratio tests when computed over noisy data (Section 4.2) then derive asymptotic distributions for our tests (Section 4.3). We use these distributions for -value computation in Section 4.4 and then evaluate empirical performance in Section 5.
When discussing asymptotics, it is important to distinguish between the actual table that was collected, let us call it , with sample size and the hypothetical data with sample size that goes to infinity. The key to asymptotically approximating the null distribution of a test statistic in the classical (non-private) case is the Central Limit Theorem (CLT), which, for example, states that as , in distribution (where is the expected value of and is the zero-mean Gaussian with variance ). In practice, this Gaussian approximation works well even if is not large. In the private setting, the data collector is planning to release where, for example, is a table of independent Laplace random variables. One way to analyze it asymptotically is to replace with (and then let ):
The first term on the right hand side is often well-approximated by the Gaussian distribution. As , the second term converges to in probability. However, we should not use as a finite-sample approximation to this term – it is only accurate when is very large (in particular, must be very large compared to the standard deviation of ). As discussed in Section 1, for many data sets of interest, this is not the case and so the extra noise due to SDC cannot be ignored.
Our proposed solution is based on the following idea. We view the first term in Equation 7 as the signal and the second term as the noise. As , we want to maintain the ratio of variance in the first term vs. variance in the second term as in the actual data . Thus we tie the standard deviation of the added noise to as follows:
where is a constant equal to 1/\sqrt{{\color[rgb]{0,0,0}n_{0}}}. In this case, so that asymptotics is only used to smooth out irregularities in the data and not to wipe out the noise terms. We justify this asymptotic regime with the following result, which states that if the data are well-approximated by a Gaussian, then the noisy data are just as well approximated by the limit of our proposed asymptotic regime. Here we measure the quality of the approximation by the largest difference in cumulative distribution functions ( the same measure used to quantify convergence to the Gaussian in the Central Limit Theorem). The proof is in online Appendix A.
Let be a sequence of (vector-valued) random variables such that in distribution. Let be an independent random variable and let for . Then:
as , converges in distribution to a random variable, whose cumulative distribution function we will refer to as .
Letting and represent the CDF and density of and letting , represent the cumulative distribution functions of , , respectively, then .
2 Relations between Likelihood Ratio and Chi-Squared Statistics
In classical statistics, likelihood ratio tests and chi-squared tests are asymptotically equivalent (Ferguson 1996). In the privacy-preserving case, this equivalence is modified.
Suppose the probabilities under the true null hypothesis are nonzero. Consider the noisy table where is a -mean random variable with fixed variance. Let denote the chi-squared statistic obtained by replacing with the noisy (and the expected counts computed from instead of ). Let denote the likelihood ratio statistic with the same substitutions and from each term subtract . Then and have the same asymptotic distribution as .
For proof, see the online Appendix B. This theorem extends in the obvious way (and essentially the same proof) for the test of sample proportions for tables and . In the classical chi-squared and likelihood ratio tests, the tests can be inaccurate when some counts are very small (e.g., 0). Since we must use noisy counts instead of raw counts, we can extend the classical rules of thumb to the following: the tests can be used if all noisy cell counts are larger than 5 + several standard deviations (of the noise). More refined rules of thumb are an open problem. The usefulness of this theorem is that sometimes it is easier to work with the likelihood ratio statistic and sometimes it is easier to work with when deriving asymptotic distributions.
3 The Asymptotic Distributions
In this section we derive asymptotic distributions for our various tests so that we can evaluate them in Section 5. We phrase the results in terms of added Laplace noise for differential privacy, but the results hold when the noise follows any -mean distribution with finite variance. We use these distributions for -value computation in Section 4.4. The proof of the following results are in the online Appendices C and D.
(Independence testing). Let be a contingency table sampled from a Multinomial distribution. Consider the noisy table where is a table of independent Laplace random variables. If the rows and columns under are independent and if no cells have probability , then as , the chi-squared statistic and the likelihood ratio statistic (Definition 3) computed from (instead of ) asymptotically have the distribution of the random variable:
where has the same distribution as and the vectorized version . It is asymptotically equivalent to the quantity we get by replacing with .
(Test of Sample Proportions). Let and be samples from Multinomial and Multinomial distributions, respectively. Consider the noisy versions and where , are vectors of independent Laplace random variables. If no cells have probability , then as , the chi-squared and likelihood ratio statistics (Definition 2) computed from and (instead of and ) asymptotically have the distribution of the random variable:
where are independent with the same distribution as and , and , are independent. It is asymptotically equivalent to the quantity we get by replacing with .
4 p-Value Algorithms
To apply Theorems 3, 4, 5 (5 comes later in this Section), we set , where is the actual table size (in the case of the test of sample proportions, we set and ). The recipe for computing -values is relatively simple:
Compute the appropriate test statistic from the noisy tables (e.g., , and/or ). Let be its value.
For goodness of fit, the test statistics are given by Equations 9 or 10.
For sample proportions, they are obtained from Definition 2 by replacing the true tables and with their noisy versions and . The and values from the definition must also be computed from the noisy tables.
For independence, they are obtained from Definition 3 by replacing the true table with the noisy version and the values from the definition are computed as .
Sample reference points (discussed next).
Set the -value to be .
The reference points are obtained from Algorithm 1 for independence testing and Algorithm 2 for test of sample proportions. Goodness-of-fit testing is actually a standard simulation trick (also noted by Gaboardi et al. 2016): since goodness-of-fit tests whether the table came from a Multinomial() distribution, for a prespecified , one simply generates tables from this distribution, adds fresh independent Laplace noise to each table to get , sets to be the value of the test statistic computed from , and compares all the to the test statistic on .
(Goodness-of-fit). Let be a sample from a Multinomial distribution. Let where is a vector of independent Laplace random variables. If no cells have probability , then as , then the statistics:
asymptotically have the same distribution as: where has the same distribution as and .
The -value algorithms satisfy -differential privacy.
The algorithms only use the differentially private noisy tables, the table sizes (which are assumed to be known according to the definition of differential privacy in Definition 4), and the density of the noise distribution (which is also public knowledge). At no point do they access the true data or the true noise that was added to it. As such, our algorithms are strictly post-processing algorithms and hence satisfy differential privacy due to the post-processing property of differential privacy (Dwork et al. 2006).
Experiments
We evaluate our proposed algorithms on a variety of datasets, both large and small, with various settings of the differential privacy parameter . In particular, we use extremely challenging conditions where the added noise is significant compared to the standard deviation of the data. Small data sets are commonly seen in the social sciences since the effort of collecting experimental data naturally limits the data size. However, large datasets allow one to use very small values (such as ) to provide very strong privacy guarantees for individuals.
The goal of the experiments is to determine at what point the methods break down. This will serve to identify the frontier for future research. Generally, we found that the tests work extremely well on large data even with large amounts of privacy noise. The tests work well on small datasets (e.g., ) where the non-private -value strongly rejects the null hypothesis (e.g., ). Beyond that, the agreement with non-private tests starts to degrade (a significant improvement over prior work (Johnson and Shmatikov 2013; Uhler et al. 2013; Yu et al. 2014) in terms of reliability and agreement with non-private tests).
We use five real data sets from which we obtain seven contingency tables. The first dataset (Czech) was used in Fienberg et al. 2010. Its purpose is to study the risk factors for coronary thrombosis with data collected from all men employed in a Czech car factory at the beginning of the year follow-up study. Its sample size is . The second dataset (Rochdale) was also used in Fienberg et al. 2010 and it contains information on households in Rochdale, UK, which was used to study the factors that influence whether a wife is economically active or not. Its sample size is . The third data set was used in Yang et al. 2012. It is a synthetic dataset which contains information about home zone, work zone and income category of individuals. It was formed using an ad hoc privacy approach for data extracted from a census database. Its sample size is . The fourth data set was used in Wright and Smucker 2014 and contains data from the National Opinion Research Center General Society Survey about white Christians’ attitude toward abortion. Its sample size is . The previous datasets are relatively small (and hence very challenging for privacy-preserving statistical testing). For a large dataset, which allows us to explore very small settings, we used the 2014 NYC Taxi data (available at http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml) which contains trip records for all NYC yellow taxis in 2014. This dataset has a sample size of . Fig. 13 from online Appendix F summarizes the dataset. Other details for these datasets can be found from online Appendix F. We evaluate the reliability of our methods in Section 5.1. We evaluate the quality of the -values on the real datasets in Section 5.2. Our experiments use 10,000 reference points to compute -values and -value results in Section 5.2 are averaged over 100 runs (of privacy-preserving table perturbations).
A -value is a strong statistical statement: under the null hypothesis, P(\text{p-value}\leq q)=q. In other words, under the null hypothesis, -values must be uniformly distributed. This criterion allows us to evaluate the reliability of tests: pick a null distribution, sample data from it, compute -values from each sampled dataset, and plot the quantiles of the resulting -values against the uniform distribution. The result is a Q-Q plot and a perfect match will be a diagonal line. We compare the reliability of our -value computations for the and likelihood ratio statistics (denoted by and ) against the reliability of the earlier method proposed by Johnson and Shmatikov 2013, which simply ran noisy tables through off-the-shelf software (we denote their results by -JS and LR-JS). In each Q-Q plot, we only show every points from the total points for each test in case we cannot distinguish between the markers due to stacking.
When no noise is added to the tables, both methods match the ideal diagonal line and so are reliable, as expected and shown in Fig. 2 (left two) for independence testing and Fig. 2 (right) for test of sample proportions.
Fig. 3 shows the Q-Q plots under a variety of settings, such as sample size , number of rows , number of columns and the type of null distribution: the null distribution probability of table entry is set to . As can be seen from Fig. 3, our methods remain reliable throughout these settings while the competitors returned unreliable -values. The upward bend of the reliability curve for LR-JS (and -JS) indicates strong bias towards producing small -values and hence would lead to many false discoveries if applied in practice.
Reliability plots for the test of sample proportions can be found in Fig. 4 and goodness-of-fit in Fig. 5. Recall that test of sample proportions tests whether two tables come from the same multinomial distribution. In the figure, we report the settings of the two table sizes and , the number of cells in each table, and the null distribution Multinomial probability vector used to generate tables for the reliability plot. The various settings for the goodness-of-fit reliability plots are presented in Fig. 5.
Those reliability results show that under privacy settings the naive method proposed by Johnson and Shmatikov 2013 is not reliable at all, and suggest that our -value computations are more reliable and thus should be used instead.
2 P-value comparison on Real Data
Now we evaluate the -values generated by our methods using real datasets and compare them to non-private -values. All private -values are averages over 100 repetitions. Please note that the experimental settings are challenging as the standard deviation of the added noise is substantial compared to the standard deviation of the data itself (). For example, the taxi data has sample size and we used . Here and noise std so a loss in agreement with non-private tests is expected. Nevertheless, we generally find that when the null hypothesis is strongly rejected (non-private or LR -value ), our private tests and also reject the null hypothesis at level . The output perturbation methods of Uhler et al. 2013; Yu et al. 2014 required too much noise and are omitted to avoid skewing the graphs. Fig. 6 shows our results for various tests on large NYC taxi data. The -values show very good performance, as the null hypothesis is rejected (as with the original data) even when the privacy noise is extremely large ().
Next we move to extremely challenging cases with small sample sizes but high relative noise. We arrange the figures so that from left to right there is a decrease in sample size and a reduction in statistical significance of non-private analysis. Fig. 7 and Fig. 10 show results for independence testing and test of sample proportions, respectively. The results show good agreement with the non-private tests when the null hypothesis is strongly rejected (non-private ) with sample sizes of or more. Agreement decreases as sample size decreases and non-private -value increases. Of particular interest is the Rochdale data (Fig. 7, right). It is a small dataset with a very high -value and small test statistic that is dominated by noise. Since the noise obscures any statistical signal, the -value behaves more like a uniform random variable (hence we add 80% error bars on the plot). This is expected, and note that the null hypothesis would be erroneously rejected only in rare circumstances (which is the expected behavior of -values).
Fig. 8 shows the results for independence tests with Census data. Again, as we move from left to right we observe smaller data sizes and less (non-private) evidence against the null hypothesis seem to reduce agreement with non-private tests. Fig. 9 shows the results for test of sample proportions with Czech car worker and Rochdale data. Again, as we move from left to right we observe smaller data sizes and less (non-private) evidence against the null hypothesis seem to reduce agreement with non-private tests. The extreme case is again the Rochdale data where the small non-private test statistic gets dominated by noise. The resulting -value is closer to being uniformly distributed as noise gets larger.
For goodness of fit tests, we used extremely small sample sizes (on the order of a few hundred) with large standard deviation of Laplace noise relative to the standard deviation of the data. The results are shown in Figs. 11 and 12. The private -values are still in good quality but their quality degrades as the sample size is further diminished. Again, the Rochdale data with only 79 data points has a very small non-private and LR value and so is completely dominated by noise, leading to large variance but no false conclusions except in rare cases (as is allowed by the definition of -value).
We have several observations from the above results. For very large datasets, our tests show very good agreement with the non-private tests even with very rigorous differential privacy guarantee. When it comes to the cases with small sample sizes but high relative noise, our tests perform very well when there is strong signal against the null hypothesis. Agreement with non-private tests appears to decrease as sample size decreases and non-private -value increases. Even for very small datasets where the statistical signal is dominated by noise, our tests only lead to false conclusions in rare cases.
Conclusions
In this paper, we revisited the topic of -differentially private hypothesis testing. We provided -value algorithms that, for the first time, allow reliable private hypothesis tests for data sizes often used in social sciences, as well as reliable tests with very strong privacy protections (i.e. small values) for large data sizes. The advantages of our algorithms over previous approaches have been verified through the extensive experiments. We believe that new test statistics tailored for the privacy domain may yield even further improvement, but those test statistics are open problems.
References
Appendix A Proof of Theorem 1
For vectors, we will use the notation to mean each component of is less than or equal to the corresponding component of . Hence a cumulative distribution function for a vector-valued random variable represents .
Since and may be discrete random variables while the Gaussian is continuous, let be a suitable measure (e.g., mixture of Lebesgue and counting measure) so that we can write to be the Radon-Nikodym derivative of the with respect to , to be the Radon-Nikodym derivative of with respect to and be the Radon-Nikodym derivative of with respect to . Then, for any :
The density of is
The density of is then
We claim that for all , , which is the CDF of the convolution of the Gaussian with . This follows immediately from Slutsky’s Theorem because the are independent from . Then,
Appendix B Proof of Theorem 2
Without loss of generality, assume all of the noisy tables have been stuffed into one vector and similarly for the expected counts .
Note that asymptotically, the correction of terms where will not be needed since converges in probability to the true parameter .
We will use the Taylor series expansion of around :
Now, both and converge in probability to the true (nonzero) null distribution and so converges to 1 in probability. Thus, an application of Slutsky’s theorem (Ferguson 1996) allows us to conclude that the term containing the integral converges in distribution to the same limit as .
Thus and converge in distribution to the same limit.
Appendix C Proof of Theorem 3
Let be a contingency table sampled from a Multinomial distribution with no entries having probability. Let be a table (with same dimensions as ) of independent Laplace random variables. Let . Then as , converges in law to the distribution of the random variable , where has the same distribution as and
Since and are independent, the result follows from the Central limit theorem and a variation of Slutsky’s theorem (Ferguson 1996).
The proof of Theorem 3 is provided below.
When convenient, we will treat , and as either vectors (with one index) or 2-d arrays with two indices (e.g., ). The conversion is simple: .
We will consider the noisy likelihood ratio statistic as it is easier to work with (we apply Theorem 2 and note that in the theorem, and so ):
use the second order taylor expansion to expand these quantities around , and . That is, .
use the fact that .
use convergence in probability of to to deduce that in probability.
Where the last two lines follow from: (a) noting that under the null hypothesis , (b) convergence in probability (e.g., ), (c) Lemma C.10 and (d) Slutsky’s theorem (Ferguson 1996).
The theorem follows for the likelihood ratio statistic. The asymptotic equivalence follows from convergence in probability. Together with Theorem 2, the theorem also follows for the chi-squared statistic.
Appendix D Proof of Theorem 4
Note that and and (which we use when applying Theorem 2).
According to Definition 2, the chi-squared statistic based on and is:
where the last line follows from a) convergence in probability \frac{(\widetilde{T}[j]+\widetilde{S}[j])}{n_{1}+n_{2}}\rightarrow\text{\theta_{0}{}}[j], (b) Lemma C.10 in Appendix C), and (c) Slutsky’s theorem (Ferguson 1996).
The theorem follows for the chi-squared statistic. Together with Theorem 2, the theorem also follows for the likelihood ratio statistic. The asymptotic equivalence also follows from convergence in probability.
Appendix E Proof of Theorem 5
According to Definition 1, the chi-squared statistic based on is:
The theorem follows for the chi-squared statistic. Together with Theorem 2, the theorem also follows for the likelihood ratio statistic.
Appendix F Datasets Used in Experiments
We provide details for the datasets used in the experiments in this section.
The first dataset (Czech) was used in Fienberg et al. 2010 and it was collected from all men employed in a Czech car factory at the beginning of a year follow-up study. It was used to study the risk factors for coronary thrombosis. Its sample size is . There are binary attributes in the dataset. A: smoking, B: strenuous mental work, C: strenuous physical work, D: systolic blood pressure, E: ratio of and lipoproteins, F: family anamnesis of coronary heart disease.
The second dataset (Rochdale) was also used in Fienberg et al. 2010 and it contains information from households in Rochdale, UK. It was used to study the factors which influence whether a wife is economically active or not. Its sample size is . There are binary attributes in the dataset. A: wife employed? (yes, if wife is economically active), B: wife’s age ? C: husband employed? D: child? (yes, if there is a child of age in the household), E: wife’s education is O-level+? F: husband’s education is O-level+? G: Asian origin? H: household working? (yes, if any other member than wife or husband of the household is working).
The third dataset was used in Yang et al. 2012. It is a synthetic dataset which contains information about home zone, work zone and income category of individuals. It was formed using an ad hoc privacy approach for data extracted from a census database. Its sample size is . There are categorical variables, with zones of origin (Home Zone), zones of destination (Work Zone) and income categories (Income Category).
The fourth dataset was used in Wright and Smucker 2014 and contains data from the National Opinion Research Center General Society Survey about white Christians’ attitude toward abortion. Its sample size is . There are categorical variables with religions (Religion), groups of education years (Education) and attitudes (Attitudes).
The fifth dataset contains all NYC yellow taxi trip data in (available at http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml). This dataset has a sample size of . There are categorical variables: passenger count (Passenger Count) and payment type (Payment Type). Fig. 13 summarizes the dataset.
Appendix G Permutation Testbed
The likelihood ratio and statistics are general-purpose statistical tools that can be adapted to a variety of tests. However, it is likely that some unknown privacy-specific test statistics could outperform them. Finding such test statistics is an open problem and, as we have seen, approximating their null distributions will generally not be easy. It would be very helpful to be able to estimate how well a new test statistic could perform on real data before figuring out all of these mathematical details. This is the purpose of our permutation-based testbed.
First, we need to choose an application that is rich enough to exhibit variations between various test statistics. Naively, one could select the goodness-of-fit test since it is possible to exactly sample from its null distribution (see Section 4). However, goodness-of-fit is too simple: rejecting the null hypothesis is the same as rejecting 1 possible distribution for the data. On the other hand, independence testing is a much richer scenario. The null hypothesis (independence of rows and columns) consists of infinitely many possible distributions (those where rows and columns are independent) and rejecting the null hypothesis means rejecting all of these distributions.
We argue that the ideal testbed is differentially-private independence testing when row and column sums are known (in other words, it protects information about individuals modulo what can be learned from the marginals). In practice, releasing row and column sums could cause a breach of privacy. Hence, this is only a method for exploring how test statistics would behave under statistical disclosure control (and for most applications it is not to be used for actually releasing analytical results). As a testbed, it has several appealing properties (which we explain in this section):
The standard permutation test of independence provides a null sampling distribution that works with any test statistic, hence there is no need to derive asymptotic approximations for the testbed.
Real-data experimental results on input-perturbation methods would carry over straightforwardly to the unrestricted case (i.e. unknown row and column sums).
Real-data experimental results on output-perturbation methods would be a lower bound on the unrestricted case, hence allowing experimenters to rule out statistics that do not perform well in the testbed.
First, we explain how to do differentially-private hypothesis testing when row and column sums are known in Section G.1. Then we discuss how experimental results would carry over to the unrestricted case in Section G.2. We illustrate its use in Section G.3. We present experiments in Section G.4 to compare likelihood ratio and with other statistics to confirm our intuition that there exist other test statistics that are better suited for privacy. Earlier work by Uhler et al. 2013 and Yu et al. 2014 studied differential privacy when only exact column sums (but not row sums) are known – this scenario would not be suitable for a testbed as the exact null distribution cannot be sampled from.
Consider a set of records and suppose the records have two distinguished categorical attributes, which we call and . We can construct a table where is the number of records with and . Although is not public knowledge, suppose its row and column sums are known (i.e. for any , and are public). We are interested in publishing the rest of the information in in a private manner that does not leak any more information beyond what the row and column sums already revealed. The privacy definition that allows us to do this was proposed by Kifer and Machanavajjhala 2014 – it ends up being a variant of differential privacy based on a concept called marginal neighbors.
(Marginal Neighbors (Kifer and Machanavajjhala 2014)). Two datasets are marginal neighbors if can be obtained from by swapping some of the attributes between records from . Two tables are marginal neighbors if they are tabulated from datasets that are marginal neighbors.
(-MN-Differential Privacy (Kifer and Machanavajjhala 2014)). satisfies -mn-differential privacy if for all and that are marginal neighbors (and have the same row and column sums as the true data) and for all ,
Achieving -mn-differential privacy is straightforward:
Given a vector-valued function , -mn-differential privacy can be achieved by adding independent Laplace noise to each component of , where (and the max is over all marginal neighbors having the same row/column sums as the true data). In particular, if just outputs the table , then .
Given a test statistic and a real table , the testbed works as follows:
If one is interested in input perturbation, compute the private statistic value , where is a random table that ensures -mn-differential privacy (e.g., a table of independent Laplace random variables). For output perturbation, set , where is a noisy random variable (such as Laplace) that ensures -mn-differential privacy.
Generate multiple pseudo-tables . Conceptually we do this by creating two urns: urn containing balls labeled ”1”, balls labeled ”2”, etc.; and urn containing balls labeled ”1”, etc. Generate samples from without replacement, generate from without replacement. Set the data and tabulate from . These are samples from the null hypothesis of independence and are probabilistically equivalent to randomly permuting the attribute in the original data (Good 2004).
Compute the test statistic value for each of the using the exact same procedure as in Step 1, but using fresh noise and operating on instead of .
Set the -value to be .
The testbed satisfies -mn-differential privacy.
Step 1 satisfies -mn-differential privacy by construction and the rest of the steps just use public data (hence they are just post-processing steps). By the post-processing property (Dwork et al. 2006), the whole procedure satisfies -mn-differential privacy.
G.2 Translating Experimental Results
Let us compare input perturbation noise for -differential privacy and for -mn-differential privacy. We need Laplace noise for the former and Laplace noise for the latter (i.e. the tables are twice as noisy). Thus -differential privacy and -mn-differential privacy use the same amount of noise and therefore would generate the same values for the test statistic (in the case of input perturbation), so the -value one gets under this testbed using -mn-differential privacy should correspond to the -value an experimenter would have gotten under -differential privacy (had statistical details, such as approximating the null distribution with unknown row/columns sums, been worked out in advance).
For output perturbation, we add Laplace noise for -mn differential privacy (where is defined in Lemma G.17) and Laplace noise for -differential privacy (where is defined in Definition 5). Thus the noise added under this testbed using -mn differential privacy is equal to the noise added under -differential privacy (and hence sets up the correspondence between the resulting -values). What if one hasn’t yet fully worked out the sensitivity under -differential privacy? In this case, the statements are slightly less precise, but by comparing the following:
it follows directly from the definitions (and the triangle inequality applied to the norm) that . This means Laplace has less variance than Laplace and so the quality of -values for output perturbation under -mn-differential privacy are expected to be a lower bound on the quality for -differential privacy. We note that typically, can be much smaller than while .
G.3 Usage
We will use our permutation testbed to compare the likelihood ratio and statistics (with both input and output perturbation) to two other statistics that are rarely, if ever, used for independence testing in the non-private case, log-likelihood (LL) and absolute difference between actual count and expected count (Diff):
An important point of distinction is that for input perturbation, we will be using the noisy values , (equal to ) and to compute the statistics instead of the true values , , . This is because in the unrestricted case, the true values will not be available once the input has been perturbed.
In contrast, for output perturbation, we will use the true values of to compute the statistics (since they are public in -mn-differential privacy). This is because the output perturbation results would be a lower bound to the quality we should expect in the unrestricted case, and the sensitivity using this method is easier to compute (another advantage of this testbed!).
We now provide calculations for the output perturbation versions of the test statistics. In some cases, depends on the dimensions of . Proofs can be found in Appendix H. One important fact to note is that the Diff statistic has lowest and so, intuitively, is expected to perform well in the privacy setting.
The value of the -statistic for a contingency tables is:
where .
The Proof of Theorem G.20 is provided in Appendix H.1. Note that table margins are , so the constant in Theorem G.20 is and so the value is for tables. However, the chi-squared statistic does not grow with under the null hypothesis, so the noise can be a significant part of the output.
The value of the -statistic for an table with , is:
where , , , and .
The proof of Theorem G.21 is provided in Appendix H.2.
A simple analysis shows that the in Theorem G.21 is .
The value of the likelihood ratio statistic for contingency tables is
The proof of Theorem G.22 is provided in Appendix H.3.
The of the likelihood ratio statistic LR on (, ) contingency tables is
where , , , .
The proof of Theorem G.23 is provided in Appendix H.4. Thus while the statistic itself does not grow with under the null hypothesis.
The value of the log-likelihood statistic based on contingency tables is
The proof of Theorem G.24 is provided in Appendix H.5.
The value of the LL statistic (from Equation 11) for tables (, ) is
where , , , .
The proof of Theorem G.25 is provided in Appendix H.6. Here also grows logarithmically.
The value of the Diff statistic (from Equation 12) is equal to .
Proof of Theorem G.26 is provided in Appendix H.7. The Diff statistic is the only one out of them that has a constant sensitivity. Clearly the value of the statistic should grow with , even under the null distribution, so it should quickly overwhelm the Laplace noise.
G.4 Experiments for Permutation Testbed
Now we experiment with our permutation testbed to compare the and likelihood ratio LR statistics to the non-traditional LL and Diff statistics considered in Section G.3. We compare the non-private versions (evaluated on actual data) to the input perturbation (with suffix “-in”) and output perturbation (with suffix “-out”) versions. The method of Uhler et al. 2013; Yu et al. 2014 is denoted -out and has lower noise requirements in the testbed than in general.
Our first batch of results is shown in the top row of Fig. 14 and illustrates three separate interesting phenomena. The left table has -values that, in the non-private case, are generally considered highly significant. The output perturbation methods (including the perturbed statistic) generally have high variance and perform much worse than the input perturbation methods due to the amount of noise they require. The exception is the Diff statistic, whose output perturbation version requires the least amount of noise. The middle table has -value that is often considered borderline for rejecting the null hypothesis. Again, we see the same pattern, with slightly more variance even for the input perturbation results. The reason for this is that the higher the non-private -value, the smaller the value of the non-private test statistic. When that is small and when is small, the resulting value of the test statistic is easily dominated by the noise (creating large variance), but does not lead to unsupported rejections of the null hypothesis. This behavior is actually expected and desired. Even in the non-private case, when the null hypothesis is true, the -values should be uniformly distributed while if the null hypothesis is false, the -values should gravitate towards very small values.
The bottom row of Fig. 14 shows typical results. Generally, the output perturbation methods have high variance because of their noise requirements. Meanwhile, input perturbation methods perform reasonably well even in these tough noise scenarios. The exception is the output perturbation of the Diff statistic, which is clearly the best and requires the least noise of all. The Diff statistic grows with , and so would not have an asymptotic distribution in the unrestricted case, however, it is a promising starting point upon which other privacy-aware statistics could be built.
Appendix H Proof of Sensitivities
From Definition 3, the statistic based on a contingency table with fixed marginals , , , is
From Definition G.15, the neighboring contingency table of has cell counts . This implies the conditions and The case of incrementing , and decrementing , is symmetric because we can exchange and . This is also true for all other neighboring contingency tables with fixed marginals. From Definition 5, the sensitivity equals
There are two ways to solve the above problem, that is, either maximize the formula inside the absolute value, or minimize it. Note we have the constraints , , , , and . Since the marginals are fixed, we only have four variables.
If ,
It is easy to see , , and maximize the formula inside the absolute value. They give the result .
If ,
It is easy to see , , and maximize the formula inside the absolute value. They give the result .
In the second way, there are also two cases.
If ,
It is easy to see , , and minimize the formula inside the absolute value. They give the result .
if ,
It is easy to see , , and minimize the formula inside the absolute value. They give the result .
Therefore, the maximum value among all cases that apply to the marginals of table is its sensitivity with fixed marginals, which leads to the result in Theorem G.20.
H.2 Proof of Theorem G.21
Let and be neighboring contingency tables no smaller than with fixed marginals. Suppose the four different entries between and locate at the intersection of row and column . We write as respectively for short. The corresponding entries in are then . Note we have the conditions and . By Definition 3 and Definition 5, the sensitivity of -statistic can be computed by
Since all marginals are known, the only variables in the function are . There are two ways to solve the problem.
Maximize the function inside the absolute value of the objective function by choosing large values for and small values for .
is the smallest possible values for them. and are the largest possible values for them (respectively). These settings can form valid tables with dimensions at least . Plug them into the objective gives . Then the indices maximizing it should be chosen.
Minimize the function inside the absolute value of the objective function by choosing large values for and small values for .
is the smallest possible values for them. and are the largest possible values for them (respectively). These settings can also form a valid table. Plugging them back to the objective function gives . Then the indices maximizing it should be chosen.
The sensitivity should be the larger one computed from the above two cases, which gives the result in Theorem G.21.
H.3 Proof of Theorem G.22
Suppose contingency table has fixed marginals , , , . From Definition G.15, the neighboring contingency table of has cell counts . This implies the conditions and . We also have the conditions . From Definition 3 and 5, the sensitivity equals
There are two ways to solve the above problem, that is, either maximize the formula inside the absolute value of the above objective function, or minimize it. Note we have the constraints , , , .
The derivative of with respect to is . When , the term and its derivative are both positive; when , the term equals . The last term has exactly the same analysis, and so does . For the term , its derivative with respect to equals . Both the term and its derivative are negative when . When , the term equals . Similarly, we can apply the same analysis to as what we do to . We use this derivative analysis for the two ways of solving the problem.
If ,
It is easy to see , , and maximize the formula inside the absolute value, which leads to .
If ,
It is easy to see , , and maximize the formula inside the absolute value, which leads to .
In the second way, there are also two cases.
If ,
It is easy to see , , and minimize the formula inside the absolute value, which leads to .
if ,
It is easy to see , , and minimize the formula inside the absolute value, which leads to .
Therefore, the maximum value among all cases that apply to the marginals of table is its sensitivity with fixed marginals, which leads to the result in Theorem G.22.
H.4 Proof of Theorem G.23
Let and be neighboring contingency tables no smaller than with fixed marginals. Suppose the four different entries between and locate at the intersection of row and column . We write as respectively for short. The corresponding entries in are then . Note we have the conditions and . By Definition 3 and Definition 5, the sensitivity of likelihood ratio statistic can be computed by
The objective function only contains variables . So, following from the proof for Theorem G.22, we do the same thing. That is, either maximize or minimize the formula inside the absolute value from the objective function.
In the first case, we choose , , , which gives the result . Next, we find the indices which maximizes it.
In the second case, we choose , , , which gives the result . Next, we find the indices which maximizes it.
The sensitivity is the larger of the above two cases, which leads to Theorem G.23.
H.5 Proof of Theorem G.24
Suppose contingency table has fixed marginals , , , . From Definition G.15, the neighboring contingency table of has cell counts . This implies the conditions and . We also have the conditions . From Equation 11 and 5, the sensitivity equals
We solve the objective function by either minimizing the formula inside the absolute value of the objective function or maximizing it.
If ,
It is easy to see , , and minimize it, which leads to .
If ,
It is easy to see , , and minimize it, which leads to .
In the second way, there are also two cases.
If ,
It is easy to see , , and maximize it, which leads to .
if ,
It is easy to see , , and maximize it, which leads to .
Therefore, the maximum value among all cases that apply to the marginals of table is its sensitivity with fixed marginals, which leads to the result in Theorem G.24.
H.6 Proof of Theorem G.25
Let and be neighboring contingency tables no smaller than with fixed marginals. Suppose the four different entries between and locate at the intersection of row and column . We write as respectively for short. The corresponding entries in are then . Note we have the conditions and . By Equation 11 and Definition 5, the sensitivity of log-likelihood statistic can be computed by
It is easy to see the objective function is maximized by either , , or , , , which leads to and respectively. Next, we find the indices that maximizes them separately.
The sensitivity is the larger from the two cases, which leads to Theorem G.25.
H.7 Proof of Theorem G.26
Suppose and are marginal-neighbors defined in Definition G.15. So, there are indices such that , , , . Also, recall that both tables have the same marginals. By Equation 12 and 5, the sensitivity for absolute difference statistic equals
That is, the sensitivity of the absolute difference statistic based on contingency tables with fixed marginals is .