Skip to contents

P(report = v | true = u) is e^eps / (k - 1 + e^eps) when v == u and 1 / (k - 1 + e^eps) otherwise, so the ratio of any two conditional probabilities is at most e^eps – the eps-local-differential-privacy guarantee. Each respondent perturbs their own value, so the collector never sees the truth. Raw counts are biased towards uniform, hence the debiased estimate that inverts the transition matrix.

Usage

morie_local_dp_randomised_response(truth, k, epsilon, seed = 2)

Arguments

truth

integer vector of true values in 0..k-1

k

number of categories

epsilon

privacy parameter; smaller is more private

seed

RNG seed

Value

list with reports, observed, estimate, p_keep, p_flip

Examples

morie_local_dp_randomised_response(truth = list(a = 1, b = 2), k = 5L, epsilon = 5L)
#> $reports
#> [1] 1 2
#> 
#> $observed
#> [1] 0.0 0.5 0.5 0.0 0.0
#> 
#> $estimate
#> [1] -0.006783655  0.510175482  0.510175482 -0.006783655 -0.006783655
#> 
#> $p_keep
#> [1] 0.9737555
#> 
#> $p_flip
#> [1] 0.006561113
#> 
#> $epsilon
#> [1] 5
#> 
#> $k
#> [1] 5
#> 
#> $n
#> [1] 2
#>