Descriptive print function for Frequencies, local Supression, Recoding, categorical risk and numerical risk.

# S4 method for class 'sdcMicroObj'
print(x, type = "kAnon", docat = TRUE, ...)

Arguments

x

An object of class sdcMicroObj-class

type

Selection of the content to be returned or printed

docat

logical, if TRUE (default) the results will be actually printed

...

the type argument for the print method, currently supported are:

  • general: basic information on the input obj such as the number of observations and variables.

  • kAnon: displays information about 2- and 3-anonymity

  • ls: displays various information if local suppression has been applied.

  • pram: displays various information if post-randomization has been applied.

  • recode: shows information about categorical key variables before and after recoding

  • risk: displays information on re-identification risks

  • numrisk: displays risk- and utility measures for numerical key variables

Details

Possible values for the type argument of the print function are: "freq": for Frequencies, "ls": for Local Supression output, "pram": for results of post-randomization "recode":for Recodes, "risk": forCategorical risk and "numrisk": for Numerical risk.

Possible values for the type argument of the freq function are: "fk": Sample frequencies and "Fk": weighted frequencies.

Author

Alexander Kowarik, Matthias Templ, Bernhard Meindl

Examples

data(testdata)
# \donttest{
sdc <- createSdcObj(testdata,
  keyVars=c('urbrur','roof','walls','relat','sex'),
  pramVars=c('water','electcon'),
  numVars=c('expend','income','savings'), w='sampling_weight')
sdc <- microaggregation(sdc, method="mdav", aggr=3)
print(sdc)
#> Infos on 2/3-Anonymity:
#> 
#> Number of observations violating
#>   - 2-anonymity: 26 (0.568%)
#>   - 3-anonymity: 52 (1.135%)
#>   - 5-anonymity: 141 (3.079%)
#> 
#> ----------------------------------------------------------------------
#> 
print(sdc, type="general")
#> The input dataset consists of 4580 rows and 15 variables.
#>   --> Categorical key variables: urbrur, roof, walls, relat, sex
#>   --> Numerical key variables: expend, income, savings
#>   --> Weight variable: sampling_weight
#> ----------------------------------------------------------------------
#> 
print(sdc, type="ls")
#> Local suppression has not been applied!
print(sdc, type="recode")
#> Information on categorical key variables:
#> 
#> Reported is the number, mean size and size of the smallest category >0 for recoded variables.
#> In parenthesis, the same statistics are shown for the unmodified data.
#> Note: NA (missings) are counted as seperate categories!
#> 
#>  Key Variable Number of categories        Mean size           
#>        <char>               <char> <char>    <char>     <char>
#>        urbrur                    2    (2)  2290.000 (2290.000)
#>          roof                    5    (5)   916.000  (916.000)
#>         walls                    3    (3)  1526.667 (1526.667)
#>         relat                    9    (9)   508.889  (508.889)
#>           sex                    2    (2)  2290.000 (2290.000)
#>  Size of smallest (>0)       
#>                 <char> <char>
#>                    646  (646)
#>                     16   (16)
#>                     50   (50)
#>                      1    (1)
#>                   2284 (2284)
#> ----------------------------------------------------------------------
#> 
print(sdc, type="risk")
#> Risk measures:
#> 
#> Number of observations with higher risk than the main part of the data: 0
#> Expected number of re-identifications: 2.41 (0.05 %)
print(sdc, type="numrisk")
#> Numerical key variables: expend, income, savings
#> 
#> Disclosure risk is currently between [0.00%; 12.95%]
#> 
#> Current Information Loss:
#>   - IL1: 384097.50
#>   - Difference of Eigenvalues: 0.020%
#> ----------------------------------------------------------------------
#> 
print(sdc, type="pram")
#> PRAM has not been applied!
print(sdc, type="kAnon")
#> Infos on 2/3-Anonymity:
#> 
#> Number of observations violating
#>   - 2-anonymity: 26 (0.568%)
#>   - 3-anonymity: 52 (1.135%)
#>   - 5-anonymity: 141 (3.079%)
#> 
#> ----------------------------------------------------------------------
#> 
print(sdc, type="comp_numvars")
#> Compare original and modified numeric key variables
#> 
#>   Variable 'expend' has been modified. The correlation is 0.998
#> 
#>        Type             Min.     1st Qu.           Median             Mean
#>      <char>           <char>      <char>           <char>           <char>
#> 1:     orig             3377 25610224.75       50462299.5 50499784.5991266
#> 2: modified 1151704.66666667    25359582 50285163.3333333 50499784.5991266
#>             3rd Qu.             Max.
#>              <char>           <char>
#> 1:      75513584.75         99962044
#> 2: 75370230.3333333 99174302.6666667
#> 
#>   Variable 'income' has been modified. The correlation is 0.998
#> 
#>        Type             Min.          1st Qu.           Median             Mean
#>      <char>           <char>           <char>           <char>           <char>
#> 1:     orig         2897.484         25100000         50750000 50115690.0034852
#> 2: modified 621527.033333333 25066666.6666667 50766666.6666667 50115690.0034852
#>     3rd Qu.     Max.
#>      <char>   <char>
#> 1:  7.5e+07    1e+08
#> 2: 75100000 99200000
#> 
#>   Variable 'savings' has been modified. The correlation is 0.998
#> 
#>        Type             Min.          1st Qu.  Median             Mean
#>      <char>           <char>           <char>  <char>           <char>
#> 1:     orig         2974.644       2434822.75 4982921 4964039.24334542
#> 2: modified 85811.8536666667 2373826.33333333 4990754 4964039.24334542
#>             3rd Qu.             Max.
#>              <char>           <char>
#> 1:          7487258          9997808
#> 2: 7522210.33333333 9928145.66666667
#> 
#> ----------------------------------------------------------------------
#> 
# }