R: Disclosure Risk for Categorical Variables

measure_risk {sdcMicro} | R Documentation

## Disclosure Risk for Categorical Variables

### Description

The function measures the disclosure risk for weighted or unweighted data. It computes the individual risk (and household risk if reasonable) and the global risk. It also computes a risk threshold based on a global risk value.

Prints a 'measure_risk'-object

Prints a 'ldiversity'-object

### Usage

    measure_risk(obj, ...)

    ldiversity(obj, ldiv_index = NULL, l_recurs_c = 2, missing = -999, ...)

    ## S3 method for class 'measure_risk'
    print(x, ...)

    ## S3 method for class 'ldiversity'
    print(x, ...)

### Arguments

`obj` | Object of class `sdcMicroObj-class`
`...` | see arguments below data: Input data, a data.frame. keyVars: names (or indices) of categorical key variables (for data-frame method) w: name of variable containing sample weights hid: name of the clustering variable, e.g. the household ID max_global_risk: Maximal global risk for threshold computation fast_hier: If TRUE a fast approximation is computed if household data are provided.
`ldiv_index` | indices (or names) of the variables used for l-diversity
`l_recurs_c` | l-Diversity Constant
`missing` | a integer value to be used as missing value in the C++ routine
`x` | Output of measure_risk() or ldiversity()

### Details

To be used when risk of disclosure for individuals within a family is considered to be statistical independent.

Internally, function freqCalc() and indivRisk are used for estimation.

Measuring individual risk: The individual risk approach based on so-called super-population models. In such models population frequency counts are modeled given a certain distribution. The estimation procedure of sample frequency counts given the population frequency counts is modeled by assuming a negative binomial distribution. This is used for the estimation of the individual risk. The extensive theory can be found in Skinner (1998), the approximation formulas for the individual risk used is described in Franconi and Polettini (2004).

Measuring hierarchical risk: If “hid” - the index of variable holding information on the hierarchical cluster structures (e.g., individuals that are clustered in households) - is provided, the hierarchical risk is additional estimated. Note that the risk of re-identifying an individual within a household may also affect the probability of disclosure of other members in the same household. Thus, the household or cluster-structure of the data must be taken into account when estimating disclosure risks. It is commonly assumed that the risk of re-identification of a household is the risk that at least one member of the household can be disclosed. Thus this probability can be simply estimated from individual risks as 1 minus the probability that no member of the household can be identified.

Global risk: The sum of the individual risks in the dataset gives the expected number of re-identifications that serves as measure of the global risk.

l-Diversity: If “ldiv_index” is unequal to NULL, i.e. if the indices of sensible variables are specified, various measures for l-diversity are calculated. l-diverstiy is an extension of the well-known k-anonymity approach where also the uniqueness in sensible variables for each pattern spanned by the key variables are evaluated.

### Value

A modified `sdcMicroObj-class` object or a list with the following elements:

- global_risk_ER: expected number of re-identification.

- global_risk: global risk (sum of indivdual risks).

- global_risk_pct: global risk in percent.

- Res: matrix with the risk, frequency in the sample and grossed-up frequency in the population (and the hierachical risk) for each observation.

- global_threshold: for a given max_global_risk the threshold for the risk of observations.

- max_global_risk: the input max_global_risk of the function.

- hier_risk_ER: expected number of re-identification with household structure.

- hier_risk: global risk with household structure (sum of indivdual risks).

- hier_risk_pct: global risk with household structure in percent.

- ldiverstiy: Matrix with Distinct_Ldiversity, Entropy_Ldiversity and Recursive_Ldiversity for each sensitivity variable.

Prints risk-information into the console

Information on L-Diversity Measures in the console

### Author(s)

Alexander Kowarik, Bernhard Meindl, Matthias Templ, Bernd Prantner, minor parts of IHSN C++ source

### References

Franconi, L. and Polettini, S. (2004) Individual risk estimation in mu-Argus: a review. Privacy in Statistical Databases, Lecture Notes in Computer Science, 262–272. Springer

Machanavajjhala, A. and Kifer, D. and Gehrke, J. and Venkitasubramaniam, M. (2007) l-Diversity: Privacy Beyond k-Anonymity. ACM Trans. Knowl. Discov. Data, 1(1)

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.

#' Templ, M. and Kowarik, A. and Meindl, B. Statistical Disclosure Control for Micro-Data Using the R Package sdcMicro. Journal of Statistical Software, 67 (4), 1–36, 2015. doi: 10.18637/jss.v067.i04

### See Also

`freqCalc`, `indivRisk`

`measure_risk`

### Examples

    ## measure_risk with sdcMicro objects:
    data(testdata)
    sdc <- createSdcObj(testdata,
      keyVars=c('urbrur','roof','walls','water','electcon'),
    numVars=c('expend','income','savings'), w='sampling_weight')

    ## risk is already estimated and available in...
    names(sdc@risk)

    ## measure risk on data frames or matrices:
    res <- measure_risk(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"))
    print(res)
    head(res$Res)
    resw <- measure_risk(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"),w="sampling_weight")
    print(resw)
    head(resw$Res)
    res1 <- ldiversity(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"),ldiv_index="electcon")
    print(res1)
    head(res1)
    res2 <- ldiversity(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"),ldiv_index=c("electcon","relat"))
    print(res2)
    head(res2)

    # measure risk with household risk
    resh <- measure_risk(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"),w="sampling_weight",hid="ori_hid")
    print(resh)

    # change max_global_risk
    rest <- measure_risk(testdata,
      keyVars=c("urbrur","roof","walls","water","sex"),
      w="sampling_weight",max_global_risk=0.0001)
    print(rest)

    ## 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')
    ## already interally applied and availabe in object sdc:
    ## sdc <- measure_risk(sdc)

[Package sdcMicro version 5.6.1 Index]