Description Usage Arguments Value Author(s) See Also Examples
View source: R/ReleasableInner.R
Margins are first perturbed according to pTable or differential privacy (Laplace noise) by
NoisyCoverMargins
.
Thereafter inner cells are estimated from the perturbed margins by
WRRnnls
, WRRginv
or WRRglmnet
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ReleasableInner(
data,
freqVar,
formula,
formulaExact = NULL,
regMethod = c("nnls", "ginv", "glmnet"),
returnDetails = FALSE,
rerun = 0,
eps = 0.5,
pMatrix = NULL,
keyVar = NULL,
wExact = 1000,
intercept = FALSE,
interceptExact = !is.null(formulaExact),
coverMargins = TRUE,
...
)
NoisyCoverMarginsToInner(
obj,
regMethod = c("nnls", "ginv", "glmnet"),
returnDetails = FALSE,
rerun = 0,
...
)
|
data |
Input data as a data frame (inner cells) |
freqVar |
Variable holding counts (name or number) |
formula |
Model formula defining cells (margins) to be perturbed |
formulaExact |
Model formula defining cells (margins) to be exact |
regMethod |
One of "nnls" (default),"ginv" or"glmnet". See |
returnDetails |
Whether to include all output from the underlying functions. |
rerun |
Possibility for a variant that iterates. Ordinary margins are re-computed in each round while the exact margins are unchanged. |
eps |
Differential privacy parameter |
pMatrix |
Output from |
keyVar |
Variable holding uniformly distributed keys (name or number). |
wExact |
Weight for highly weighted margins |
intercept |
Parameter to |
interceptExact |
Parameter to |
coverMargins |
Parameter to |
... |
Parameters to or |
obj |
Output from |
Estimated inner cells frequencies (yHat) or a list including all output from
NoisyCoverMargins
and WRRnnls
, WRRginv
or WRRglmnet
.
Øyvind Langsrud
Another way to obtain releasable inner cell frequencies from protected tabular data is to
run SuppressDec
with input from PTxyz
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | y <- c(3, 1, 5, 6, 4, 8, 2, 7, 27)
cols <- paste("col", col(matrix(1:9, 3, 3)), sep = "")
rows <- paste("row", row(matrix(1:9, 3, 3)), sep = "")
z <- data.frame(rows, cols, y)
pMatrix <- Pmatrix()
z$keys <- runif(9)
# Non-negative estimates without noise
ReleasableInner(z, "y", ~rows + cols, eps = Inf)
# Non-negative estimates with Laplace noise
ReleasableInner(z, "y", ~rows + cols, eps = 0.5)
# Using pTable and keys. Overall total perturbed.
ReleasableInner(z, "y", ~rows + cols, pMatrix = pMatrix, keyVar = "keys", intercept = TRUE)
# Generalized inverse (not non-negative)
ReleasableInner(z, "y", ~rows + cols, pMatrix = pMatrix, keyVar = "keys", intercept = TRUE,
regMethod = "ginv")
# Preserving row totals
ReleasableInner(z, "y", ~rows + cols, ~rows)
# Other data and detailed output
z2 <- EasyData("z2")
a1 <- ReleasableInner(z2, "ant", ~region + kostragr * hovedint, ~kostragr + hovedint,
returnDetails = TRUE)
# Other values of thresh and wExact
a2 <- ReleasableInner(z2, "ant", ~region + kostragr * hovedint, ~kostragr + hovedint,
regMethod = "glmnet", thresh = 1E-8, wExact = 100)
# Not non-negative
a3 <- ReleasableInner(z2, "ant", ~region + kostragr * hovedint, ~kostragr + hovedint,
regMethod = "glmnet", lower.limits = -Inf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.