NoisyCoverMargins: Laplace or pTable perturbed margins

Description Usage Arguments Details Value Author(s) Examples

View source: R/CoverMargins.R

Description

The function make use of CoverMarginsExact.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
NoisyCoverMargins(
  data,
  freqVar,
  formula,
  formulaExact = NULL,
  eps = 0.5,
  pMatrix = NULL,
  keyVar = NULL,
  ...
)

Arguments

data

Input data as a data frame (inner cells)

freqVar

Variable holding counts (name or number)

formula

Model formula defining cells to be perturbed

formulaExact

Model formula defining cells to be exact

eps

Differential privacy parameter

pMatrix

Output from Pmatrix

keyVar

Variable holding uniformly distributed keys (name or number). See details.

...

Further parameters to CoverMarginsExact

Details

In this function individual keys (cell keys) are not taken as input. Possible individual keys must be "summed up" to inner cell keys beforehand. Zeros keys corresponding to zero frequencies are unproblematic when zeros are not perturbed. By default (keyVar==NULL), the keys corresponding to nonzero frequencies are generated by runif (otherwise zero).

Value

A list

Author(s)

Øyvind Langsrud

Examples

1
2
3
4
5
6
z2 <- EasyData("z2")
a1 <- NoisyCoverMargins(z2, "ant", ~region + kostragr * hovedint)
a2 <- NoisyCoverMargins(z2, "ant", ~region + kostragr * hovedint, ~kostragr + hovedint, eps = 0.25)
a3 <- NoisyCoverMargins(cbind(z2,keyVar = runif(44) * (z2$ant>0)), "ant", 
                        ~region + kostragr * hovedint, ~kostragr + hovedint, 
                        pMatrix = Pmatrix(), keyVar = "keyVar")

olangsrud/experimentalRpackage documentation built on Sept. 20, 2021, 10:32 p.m.