Learn R Programming

sdcMicro (version 3.1.2)

measure_risk: Measure Risk for weighted or unweighted data / Individual risk to household risk / Compute a risk threshold based on a global risk value

Description

measure risk like in mu-argus / To be used when risk of disclosure for individuals within a family is considered to be statistical independent. This is the assumption made in mu-Argus risk model. / To be used when the risk measurement at individual level can be used to calculate the file level risk by taking the average of the individual risk.

Usage

measure_risk(data,keyVars,w=NULL,missing=-999,hid=NULL,max_global_risk=.01,force_hier=FALSE)
ldiversity(data,keyVars,missing=-999,l_recurs_c=2,ldiv_index=NULL)
## S3 method for class 'measure_risk':
print(x, ...)
## S3 method for class 'ldiversity':
print(x, ...)

Arguments

data
Input data
keyVars
Names of key variables
w
name of variable containing sample weights
hid
Household ID
missing
A integer value to be used as missing value in the C++ routine
l_recurs_c
L-Diversity Constant
ldiv_index
indices (or names) of the variables used for l-diversity
x
Output of measure_risk, measure_hier or measure_thres
max_global_risk
Maximal global risk for threshold computation
force_hier
If TRUE a computation of the hierachical risk will be performed for large households, which is very slow.
...
currently unused

Value

  • 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 group counts, the risk, the group size (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 andRecursive_Ldiversity for each sensitivity variable

References

http://neon.vb.cbs.nl/casc/Software/MuManual4.1.pdf

Examples

Run this code
# measure_risk
  data(testdata)
  res <- measure_risk(testdata,c("urbrur","roof","walls","water","sex"))
  print(res)
  head(res$Res)
  resw <- measure_risk(testdata,c("urbrur","roof","walls","water","sex"),w="sampling_weight")
  print(resw)
  head(resw$Res)
  res1 <- ldiversity(testdata,c("urbrur","roof","walls","water","sex"),ldiv_index="electcon")
  print(res1)
  head(res1)
  res2 <- ldiversity(testdata,c("urbrur","roof","walls","water","sex"),ldiv_index=c("electcon","relat"))
  print(res2)
  head(res2)
  # measure risk with household risk
  resh <- measure_risk(testdata,c("urbrur","roof","walls","water","sex"),w="sampling_weight",hid="ori_hid")
  print(resh)
  # change max_global_risk
  rest <- measure_risk(testdata,c("urbrur","roof","walls","water","sex"),w="sampling_weight",max_global_risk=0.0001)
  print(rest)

Run the code above in your browser using DataLab