Skip to contents

Laplace noise on each bin count. Because the bins are disjoint, one record touches exactly one of them: this is PARALLEL composition, so the same epsilon covers every bin at once. Dividing the budget across bins is the common error and wastes it entirely.

Usage

morie_dp_histogram(
  x,
  bins = 10,
  epsilon = 1,
  range_ = NULL,
  seed = NULL,
  nonneg = TRUE
)

Arguments

x

values to bin.

bins

bin count or explicit edges.

epsilon

privacy budget.

range_

optional c(min, max) for the binning range.

seed

optional integer seed.

nonneg

clamp negative counts to zero (post-processing, free).

Value

list with release, raw, true_counts, edges, noise_scale.

Details

The sensitivity used is 2, which covers the add/remove-one neighbouring relation where a record can move between bins.

References

McSherry, F. (2009). Privacy integrated queries. SIGMOD, 19-30. (parallel composition)

Examples

set.seed(1)
morie_dp_histogram(rnorm(500), bins = 5, epsilon = 1)$noise_scale
#> [1] 2