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

View source: R/LocalRecProg.R

LocalRecProgR Documentation

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

a data.frame or a sdcMicroObj-class-object

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

categorical

Names of categorical variables

numerical

Names of numerical variables

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.

Value

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

Methods

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

Author(s)

Alexander Kowarik, Bernd Prantner, IHSN C++ source, Akimichi Takemura

References

Kowarik, A. and Templ, M. and Meindl, B. and Fonteneau, F. and Prantner, B.: Testing of IHSN Cpp Code and Inclusion of New Methods into sdcMicro, in: Lecture Notes in Computer Science, J. Domingo-Ferrer, I. Tinnirello (editors.); Springer, Berlin, 2012, ISBN: 978-3-642-33626-3, pp. 63-77. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-642-33627-0_6")}

Examples

data(testdata2)
cat_vars <- c("urbrur", "roof", "walls", "water", "sex", "relat")
anc_var <- c("water2", "water3", "relat2")
anc_setting <- c("water","water","relat")

r1 <- LocalRecProg(
  obj = testdata2,
  categorical = cat_vars,
  missingValue = -99)
r2 <- LocalRecProg(
  obj = testdata2,
  categorical = cat_vars,
  ancestor = anc_var,
  ancestor_setting = anc_setting,
  missingValue = -99)
r3 <- LocalRecProg(
  obj = testdata2,
  categorical = cat_vars,
  ancestor = anc_var,
  ancestor_setting = anc_setting,
  missingValue = -99,
  FindLowestK = FALSE)

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


sdcTools/sdcMicro documentation built on March 15, 2024, 12:32 p.m.