Learn R Programming

DPpack (version 0.2.2)

medianDP: Differentially Private Median

Description

This function computes the differentially private median of an input vector at a user-specified privacy level of epsilon.

Usage

medianDP(
  x,
  eps,
  lower.bound,
  upper.bound,
  which.sensitivity = "bounded",
  mechanism = "exponential"
)

Value

Sanitized median based on the bounded and/or unbounded definitions of differential privacy.

Arguments

x

Numeric vector of which the median will be taken.

eps

Positive real number defining the epsilon privacy budget.

lower.bound

Real number giving the global or public lower bound of x.

upper.bound

Real number giving the global or public upper bound of x.

which.sensitivity

String indicating which type of sensitivity to use. Can be one of {'bounded', 'unbounded', 'both'}. If 'bounded' (default), returns result based on bounded definition for differential privacy. If 'unbounded', returns result based on unbounded definition. If 'both', returns result based on both methods Kifer2011DPpack. Note that if 'both' is chosen, each result individually satisfies (eps, 0)-differential privacy, but may not do so collectively and in composition. Care must be taken not to violate differential privacy in this case.

mechanism

String indicating which mechanism to use for differential privacy. Currently the following mechanisms are supported: {'exponential'}. See ExponentialMechanism for a description of the supported mechanisms.

References

Dwork2006aDPpack

Kifer2011DPpack

Smith2011aDPpack

Examples

Run this code
D <- stats::rnorm(500)
lower.bound <- -3 # 3 standard deviations below mean
upper.bound <- 3 # 3 standard deviations above mean

eps <- 1
# Get median satisfying pure 1-differential privacy
private.median <- medianDP(D, eps, lower.bound, upper.bound)
private.median

Run the code above in your browser using DataLab