Skip to contents

Mirrors Python morie.fn.rappor.

Usage

morie_rappor(
  values,
  k = 16,
  h = 2,
  f = 0.5,
  p = 0.5,
  q = 0.75,
  cohorts = 1,
  variant = "full",
  seed = 0
)

Arguments

values

Client values.

k

Bloom filter width.

h

Number of hash functions.

f, p, q

RAPPOR parameters.

cohorts

Number of cohorts.

variant

One of "full", "one-time" (skips the instantaneous step) or "basic" (one-hot, no Bloom filter).

seed

RNG seed.

Value

A list with the reports, per-cohort bit counts and cohort_sizes.

References

Erlingsson, Pihur & Korolova (2014), ACM CCS, 1054-1067.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_rappor(V)
#> $estimate
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,]    4    5    3    4    6    4    6    5    2     4     5     4     4     6
#>      [,15] [,16]
#> [1,]     6     6
#> 
#> $reports
#> $reports[[1]]
#>  [1] 0 1 0 0 0 0 1 0 0 1 1 0 0 0 1 1
#> 
#> $reports[[2]]
#>  [1] 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 1
#> 
#> $reports[[3]]
#>  [1] 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1
#> 
#> $reports[[4]]
#>  [1] 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 0
#> 
#> $reports[[5]]
#>  [1] 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 1
#> 
#> $reports[[6]]
#>  [1] 0 0 1 1 1 0 1 0 0 1 0 1 1 1 1 1
#> 
#> $reports[[7]]
#>  [1] 1 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1
#> 
#> $reports[[8]]
#>  [1] 1 1 0 0 1 1 1 1 1 0 0 1 0 1 1 0
#> 
#> 
#> $counts
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,]    4    5    3    4    6    4    6    5    2     4     5     4     4     6
#>      [,15] [,16]
#> [1,]     6     6
#> 
#> $cohort_sizes
#> [1] 8
#> 
#> $cohort_of
#> [1] 0 0 0 0 0 0 0 0
#> 
#> $k
#> [1] 16
#> 
#> $h
#> [1] 2
#> 
#> $cohorts
#> [1] 1
#> 
#> $alphabet
#> NULL
#> 
#> $variant
#> [1] "full"
#> 
#> $f
#> [1] 0.5
#> 
#> $p
#> [1] 0.5
#> 
#> $q
#> [1] 0.75
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "RAPPOR encode (Erlingsson, Pihur & Korolova 2014, Sec. 2)"
#>