| dplapcnt | R Documentation |
Releases a count with discrete Laplace noise, P(y) \propto
e^{-\epsilon |y|}, so the release is a whole number. Use it for the
number of records matching a predicate (for example incidents in a
division-year). Adding or removing one record changes the count by at
most 1, and the release is pure \epsilon-DP under that
add-or-remove-one relation, the one every mechanism in this package uses.
dplapcnt(truecnt, epsilon, budget = NULL)
truecnt |
Non-negative integer; the true count. |
epsilon |
Privacy loss (smaller means more noise, stronger privacy). |
budget |
Optional |
The noise is drawn from the operating system's CSPRNG with the exact
sampler of Canonne, Kamath and Steinke (2020), in integer arithmetic, so
no floating-point artefact separates neighbouring datasets and
set.seed() has no effect. epsilon is used as a rational with
denominator 2^{20}, rounded down.
The noised count, a whole number (it can be negative; clip with
pmax(0, x) for display, which is post-processing and costs no
privacy).
Canonne, Kamath and Steinke (2020), The Discrete Gaussian for Differential Privacy, NeurIPS. Mironov (2012), On Significance of the Least Significant Bits for Differential Privacy, CCS.
# A single noised release of a true count of 42 (different every call).
dplapcnt(truecnt = 42, epsilon = 1.0)
# Smaller epsilon = stronger privacy = more noise.
dplapcnt(42, epsilon = 0.1)
dplapcnt(42, epsilon = 5.0)
# The mechanism is unbiased: averaging many releases returns about the truth
# (for illustration; releasing many answers spends many epsilons).
mean(replicate(500, dplapcnt(42, epsilon = 1.0)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.