View source: R/StatFunctions.R
pooledVarDP | R Documentation |
This function computes the differentially private pooled variance from two or more vectors of data at user-specified privacy levels of epsilon and delta.
pooledVarDP(
...,
eps = 1,
lower.bound,
upper.bound,
which.sensitivity = "bounded",
mechanism = "Laplace",
delta = 0,
type.DP = "aDP",
approx.n.max = FALSE
)
... |
Two or more vectors from which to compute the pooled variance. |
eps |
Positive real number defining the epsilon privacy budget. |
lower.bound |
Real number giving the global or public lower bound of the input data. |
upper.bound |
Real number giving the global or public upper bound of the input data. |
which.sensitivity |
String indicating which type of sensitivity to use. Can be one of {'bounded', 'unbounded', 'both'}. If 'bounded' (default), returns result based on bounded definition for differential privacy. If 'unbounded', returns result based on unbounded definition. If 'both', returns result based on both methods \insertCiteKifer2011DPpack. Note that if 'both' is chosen, each result individually satisfies (eps, delta)-differential privacy, but may not do so collectively and in composition. Care must be taken not to violate differential privacy in this case. |
mechanism |
String indicating which mechanism to use for differential
privacy. Currently the following mechanisms are supported: {'Laplace',
'Gaussian', 'analytic'}. Default is Laplace. See |
delta |
Nonnegative real number defining the delta privacy parameter. If 0 (default), reduces to eps-DP. |
type.DP |
String indicating the type of differential privacy desired for the Gaussian mechanism (if selected). Can be either 'pDP' for probabilistic DP \insertCiteMachanavajjhala2008DPpack or 'aDP' for approximate DP \insertCiteDwork2006bDPpack. Note that if 'aDP' is chosen, epsilon must be strictly less than 1. |
approx.n.max |
Logical indicating whether to approximate n.max (defined to be the length of the largest input vector) in the computation of the global sensitivity based on the upper and lower bounds of the data \insertCiteLiu2019bDPpack. Approximation is best if n.max is very large. |
Sanitized pooled variance based on the bounded and/or unbounded definitions of differential privacy.
Dwork2006aDPpack
\insertRefKifer2011DPpack
\insertRefMachanavajjhala2008DPpack
\insertRefDwork2006bDPpack
\insertRefLiu2019bDPpack
# Build datasets
D1 <- stats::rnorm(500, mean=3, sd=2)
D2 <- stats::rnorm(200, mean=3, sd=2)
D3 <- stats::rnorm(100, mean=3, sd=2)
lower.bound <- -3 # 3 standard deviations below mean
upper.bound <- 9 # 3 standard deviations above mean
# Get private pooled variance without approximating n.max
private.pooled.var <- pooledVarDP(D1, D2, D3, eps=1, lower.bound=lower.bound,
upper.bound = upper.bound)
private.pooled.var
# If n.max is sensitive, we can also use
private.pooled.var <- pooledVarDP(D1, D2, D3, eps=1, lower.bound=lower.bound,
upper.bound = upper.bound,
approx.n.max = TRUE)
private.pooled.var
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.