Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


sdcMicro (version 4.6.0)

LocalRecProg: Local recoding via Edmond's maximum weighted matching algorithm

Description

To be used on both categorical and numeric input variables, although usage on categorical variables is the focus of the development of this software.

Usage

LocalRecProg(obj, ancestors = NULL, ancestor_setting = NULL, k_level = 2, FindLowestK = TRUE, weight = NULL, lowMemory = FALSE, missingValue = NA, ...)

Arguments

obj
Input data or object of class sdcMicroObj
ancestors
Names of ancestors of the cateorical variables
ancestor_setting
For each ancestor the corresponding categorical variable
k_level
Level for k-anonymity
FindLowestK
requests the program to look for the smallest k that results in complete matches of the data.
weight
A weight for each variable (Default=1)
lowMemory
Slower algorithm with less memory consumption
missingValue
The output value for a suppressed value.
...
see arguments below
  • categoricalNames of categorical variables
  • numericalNames of numerical variables

Value

dataframe with original variables and the supressed variables (suffix _lr). / the modified sdcMicroObj-class

Methods

list("signature(obj = \"sdcMicroObj\")")

Details

Each record in the data represents a category of the original data, and hence all records in the input data should be unique by the N Input Variables. To achieve bigger category sizes (k-anoymity), one can form new categories based on the recoding result and repeatedly apply this algorithm.

References

http://www.stat.t.u-tokyo.ac.jp/~takemura/papers/localrec.pdf

Examples

Run this code
# LocalRecProg
data(testdata2)
r1=LocalRecProg(testdata2,
  categorical=c("urbrur", "roof", "walls", "water", "sex", "relat"),
  missingValue=-99)
r2=LocalRecProg(testdata2,
  categorical=c("urbrur", "roof", "walls", "water", "sex", "relat"),
    ancestor=c("water2", "water3", "relat2"),
    ancestor_setting=c("water","water","relat"),missingValue=-99)
r3=LocalRecProg(testdata2,
  categorical=c("urbrur", "roof", "walls", "water", "sex", "relat"),
    ancestor=c("water2", "water3", "relat2"),
    ancestor_setting=c("water","water","relat"),missingValue=-99,
    FindLowestK=FALSE)

## for objects of class sdcMicro:
data(testdata2)
sdc <- createSdcObj(testdata2,
  keyVars=c('urbrur','roof','walls','water','electcon','relat','sex'),
  numVars=c('expend','income','savings'), w='sampling_weight')
sdc <- LocalRecProg(sdc)

Run the code above in your browser using DataLab