A simple method to perfom local suppression.

localSupp(obj, threshold = 0.15, keyVar)

Arguments

obj

object of class freqCalc or sdcMicroObj-class.

threshold

threshold for individual risk

keyVar

Variable on which some values might be suppressed

Value

an updated object of class freqCalc or the sdcMicroObj-class

object with manipulated data.

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. doi:10.1007/978-3-319-50272-4 doi:10.1007/978-3-319-50272-4

See also

Author

Matthias Templ and Bernhard Meindl

Examples

data(francdat)
keyVars <- paste0("Key",1:4)
# \donttest{
f <- freqCalc(francdat, keyVars = keyVars, w = 8)
f
#> 
#>  --------------------------
#> 4 obs. violate 2-anonymity 
#> 8 obs. violate 3-anonymity 
#>  --------------------------
f$fk
#> [1] 2 2 2 1 1 1 1 2
f$Fk
#> [1] 110.0  84.5  84.5  17.0 541.0   8.0   5.0 110.0

## individual risk calculation:
indivf <- indivRisk(f)
indivf$rk
#> [1] 0.01714426 0.02204233 0.02204233 0.17707583 0.01165448 0.29706308 0.40235948
#> [8] 0.01714426

## Local Suppression
localS <- localSupp(f, keyVar = "Key4", threshold = 0.15)
#> 3observations has individual risks >=0.15and were suppressed!
f2 <- freqCalc(localS$freqCalc, keyVars = keyVars, w = 8)
indivf2 <- indivRisk(f2)
indivf2$rk
#> [1] 0.017144262 0.022042326 0.022042326 0.177075834 0.003581243 0.003581243
#> [7] 0.402359478 0.017144262
identical(indivf$rk, indivf2$rk)
#> [1] FALSE

## 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")
#> Local suppression:
#>    KeyVar      | Suppressions (#)      | Suppressions (%)
#>    <char> <char>            <int> <char>           <char>
#>    urbrur      |              157      |            3.428
#>      roof      |                0      |            0.000
#>     walls      |                0      |            0.000
#>     water      |                0      |            0.000
#>  electcon      |                0      |            0.000
#>     relat      |                0      |            0.000
#>       sex      |                0      |            0.000
#> ----------------------------------------------------------------------
#> 
# }