Learn R Programming

sdcMicro (version 5.7.8)

localSupp: Local Suppression

Description

A simple method to perfom local suppression.

Usage

localSupp(obj, threshold = 0.15, keyVar)

Value

an updated object of class freqCalc or the sdcMicroObj-class

object with manipulated data.

Arguments

obj

object of class freqCalc or sdcMicroObj-class.

threshold

threshold for individual risk

keyVar

Variable on which some values might be suppressed

Author

Matthias Templ and Bernhard Meindl

Details

Values of high risk (above the threshold) of a certain variable (parameter keyVar) are suppressed.

References

Templ, M. Statistical Disclosure Control for Microdata Using the R-Package sdcMicro, Transactions on Data Privacy, vol. 1, number 2, pp. 67-85, 2008. http://www.tdp.cat/issues/abs.a004a08.php

Templ, M. Statistical Disclosure Control for Microdata: Methods and Applications in R. Springer International Publishing, 287 pages, 2017. ISBN 978-3-319-50272-4. tools:::Rd_expr_doi("10.1007/978-3-319-50272-4") tools:::Rd_expr_doi("10.1007/978-3-319-50272-4")

See Also

freqCalc, indivRisk

Examples

Run this code
data(francdat)
keyVars <- paste0("Key",1:4)
# \donttest{
f <- freqCalc(francdat, keyVars = keyVars, w = 8)
f
f$fk
f$Fk

## individual risk calculation:
indivf <- indivRisk(f)
indivf$rk

## Local Suppression
localS <- localSupp(f, keyVar = "Key4", threshold = 0.15)
f2 <- freqCalc(localS$freqCalc, keyVars = keyVars, w = 8)
indivf2 <- indivRisk(f2)
indivf2$rk
identical(indivf$rk, indivf2$rk)

## select another keyVar and run localSupp once again,
# if you think the table is not fully protected

## for objects of class sdcMicro:
data(testdata)
sdc <- createSdcObj(
  dat = testdata,
  keyVars = c("urbrur", "roof", "walls", "water", "electcon", "relat", "sex"),
  w = "sampling_weight"
)
sdc <- localSupp(sdc, keyVar = "urbrur", threshold = 0.045)
print(sdc, type = "ls")
# }

Run the code above in your browser using DataLab