AnalyticGaussianMechanism: Analytic Gaussian Mechanism

AnalyticGaussianMechanismR Documentation

Analytic Gaussian Mechanism

Description

This function implements the analytic Gaussian mechanism for differential privacy by adding noise to the true value(s) of a function according to specified values of epsilon, delta, and l2-global sensitivity(-ies). The noise scale is for the analytic Gaussian mechanism \insertCiteBalle2018DPpack. Global sensitivity calculated based either on bounded or unbounded differential privacy can be used \insertCiteKifer2011DPpack. If true.values is a vector, the provided epsilon and delta are divided such that (epsilon, delta)-level differential privacy is satisfied across all function values. In the case that each element of true.values comes from its own function with different corresponding sensitivities, a vector of sensitivities may be provided. In this case, if desired, the user can specify how to divide epsilon and delta among the function values using alloc.proportions.

Usage

AnalyticGaussianMechanism(
  true.values,
  eps,
  delta,
  sensitivities,
  alloc.proportions = NULL,
  tol = 1e-12
)

Arguments

true.values

Real number or numeric vector corresponding to the true value(s) of the desired function.

eps

Positive real number defining the epsilon privacy parameter.

delta

Positive real number defining the delta privacy parameter.

sensitivities

Real number or numeric vector corresponding to the l2-global sensitivity(-ies) of the function(s) generating true.values. This value must be of length 1 or of the same length as true.values. If it is of length 1 and true.values is a vector, this indicates that the given sensitivity applies simultaneously to all elements of true.values and that the privacy budget need not be allocated (alloc.proportions is unused in this case). If it is of the same length as true.values, this indicates that each element of true.values comes from its own function with different corresponding sensitivities. In this case, the l2-norm of the provided sensitivities is used to generate the Gaussian noise.

alloc.proportions

Optional numeric vector giving the allocation proportions of epsilon and delta to the function values in the case of vector-valued sensitivities. For example, if sensitivities is of length two and alloc.proportions = c(.75, .25), then 75% of the privacy budget eps (and 75% of delta) is allocated to the noise computation for the first element of true.values, and the remaining 25% is allocated to the noise computation for the second element of true.values. This ensures (eps, delta)-level privacy across all computations. Input does not need to be normalized, meaning alloc.proportions = c(3,1) produces the same result as the example above.

tol

Optional error tolerance for binary search used in determining the noise parameter for the analytic Gaussian mechanism. Defaults to 1e-12.

Value

Sanitized function values based on the bounded and/or unbounded definitions of differential privacy, sanitized via the analytic Gaussian mechanism.

References

\insertRef

Dwork2006aDPpack

\insertRef

Balle2018DPpack

\insertRef

Kifer2011DPpack

\insertRef

Liu2019aDPpack

\insertRef

Dwork2006bDPpack

Examples

# Simulate dataset
n <- 100
c0 <- 5 # Lower bound
c1 <- 10 # Upper bound
D1 <- stats::runif(n, c0, c1)

# Privacy budget
epsilon <- 1.1 # epsilon can be > 1 for analytic Gaussian mechanism
delta <- 0.01
sensitivity <- (c1-c0)/n

private.mean <- AnalyticGaussianMechanism(mean(D1), epsilon,
                                          delta, sensitivity)
private.mean


# Simulate second dataset
d0 <- 3 # Lower bound
d1 <- 6 # Upper bound
D2 <- stats::runif(n, d0, d1)
D <- matrix(c(D1,D2),ncol=2)
sensitivities <- c((c1-c0)/n, (d1-d0)/n)
epsilon <- 0.9 # Total privacy budget for all means
delta <- 0.01

# Here, sensitivities are summed and the result is used to generate Laplace
# noise. This is essentially the same as allocating epsilon proportional to
# the corresponding sensitivity. The results satisfy (0.9,0.01)-approximate
# differential privacy.
private.means <- AnalyticGaussianMechanism(apply(D, 2, mean), epsilon,
                                           delta, sensitivities)
private.means

# Here, privacy budget is explicitly split so that 75% is given to the first
# vector element and 25% is given to the second.
private.means <- AnalyticGaussianMechanism(apply(D, 2, mean), epsilon,
                                           delta, sensitivities,
                                           alloc.proportions = c(0.75, 0.25))
private.means


DPpack documentation built on Sept. 30, 2024, 9:41 a.m.