Skip to contents

Creates one or more sets of requirements for feasibility intervals of cell values in protected tables. These can include lower bound requirements ("lomax_"), upper bound requirements ("upmin_"), and/or minimum width requirements ("rlim_*"). The requirements may be specified as relative percentages or as absolute distances, and can be set symmetrically around the true cell value or separately for lower and upper bounds.

Usage

IntervalLimits(
  ...,
  protectionPercent = 0,
  protectionLimit = 0,
  loProtectionPercent = protectionPercent,
  loProtectionLimit = protectionLimit,
  rangePercent = 0,
  rangeMin = 0,
  primary,
  num,
  freq,
  freqVar,
  dominanceVar = NULL,
  intervalVar = NULL
)

Arguments

...

Unused parameters

protectionPercent

Required distance in percent between the true cell value and the upper bound of the feasibility interval. If loProtectionPercent is not set, the same percentage distance is also required to the lower bound.

protectionLimit

Required absolute distance between the true cell value and the upper bound of the feasibility interval. If loProtectionLimit is not set, the same absolute distance is also required to the lower bound.

loProtectionPercent

Required distance in percent between the true cell value and the lower bound of the feasibility interval. Is by default set to protectionPercent, i.e. symmetrical requirements.

loProtectionLimit

Required absolute distance between the true cell value and the lower bound of the feasibility interval. Is by default set to protectionLimit, i.e. symmetrical requirements.

rangePercent

Minimum required width of the feasibility interval expressed as a percentage of the true cell value.

rangeMin

Minimum required width of the feasibility interval expressed as an absolute value.

primary

The primary vector generated by parent function

num

The num data frame generated by parent function

freq

The freq vector generated by parent function

freqVar

As input to e.g. SuppressSmallCounts()

dominanceVar

As input to e.g. SuppressDominantCells()

intervalVar

Numerical variable(s) used for interval calculations. If NULL, the variable names may be inferred from the num data frame as a consequence of interval requirements created by the primary function(s). If no variables can be inferred this way, dominanceVar, first numVar or freqVar will be used.

Value

A matrix with column names constructed from the type of requirement and the associated variable name.

Note

Interval requirements can also be generated by the primary suppression functions when protectionIntervals = TRUE is specified (see examples below). More details are given in the description of protectionIntervals in the MagnitudeRule() and PrimaryDefault() functions.

Examples

dat <- SSBtoolsData("magnitude1")
dat["num2"] <- 1:nrow(dat)

SuppressDominantCells(data = dat, 
    numVar = "value", 
    formula = ~sector2 * geo + sector4 * eu, 
    contributorVar = "company", 
    k = c(80, 99), 
    rangePercent = 10, rangeMin = 1,
    protectionPercent = 3, 
    protectionLimit = 5, loProtectionLimit = 4)
#> [preAggregate 20*7->20*7]
#> [extraAggregate 20*7->10*7] Checking .....
#> GaussSuppression_numttHTT: .........:::::
#>         geo       sector4 freq value rlim_value lomax_value upmin_value primary
#> 1     Total         Total   20 462.3         NA          NA          NA   FALSE
#> 2     Total       private   16 429.5         NA          NA          NA   FALSE
#> 3     Total        public    4  32.8         NA          NA          NA   FALSE
#> 4   Iceland         Total    4  37.1         NA          NA          NA   FALSE
#> 5  Portugal         Total    8 162.5         NA          NA          NA   FALSE
#> 6     Spain         Total    8 262.7         NA          NA          NA   FALSE
#> 7     Total   Agriculture    4 240.2      24.02     232.994     247.406    TRUE
#> 8     Total Entertainment    6 131.5         NA          NA          NA   FALSE
#> 9     Total  Governmental    4  32.8         NA          NA          NA   FALSE
#> 10    Total      Industry    6  57.8         NA          NA          NA   FALSE
#> 11       EU         Total   16 425.2         NA          NA          NA   FALSE
#> 12    nonEU         Total    4  37.1         NA          NA          NA   FALSE
#> 13  Iceland       private    4  37.1         NA          NA          NA   FALSE
#> 14 Portugal       private    6 138.9         NA          NA          NA   FALSE
#> 15    Spain       private    6 253.5         NA          NA          NA   FALSE
#> 16 Portugal        public    2  23.6       2.36      19.600      28.600    TRUE
#> 17    Spain        public    2   9.2       1.00       5.200      14.200    TRUE
#> 18       EU   Agriculture    4 240.2      24.02     232.994     247.406    TRUE
#> 19       EU Entertainment    5 114.7         NA          NA          NA   FALSE
#> 20    nonEU Entertainment    1  16.8       1.68      12.800      21.800    TRUE
#> 21       EU  Governmental    4  32.8         NA          NA          NA   FALSE
#> 22       EU      Industry    3  37.5         NA          NA          NA   FALSE
#> 23    nonEU      Industry    3  20.3         NA          NA          NA   FALSE
#>    suppressed
#> 1       FALSE
#> 2       FALSE
#> 3       FALSE
#> 4       FALSE
#> 5       FALSE
#> 6       FALSE
#> 7        TRUE
#> 8       FALSE
#> 9       FALSE
#> 10       TRUE
#> 11      FALSE
#> 12      FALSE
#> 13      FALSE
#> 14       TRUE
#> 15       TRUE
#> 16       TRUE
#> 17       TRUE
#> 18       TRUE
#> 19       TRUE
#> 20       TRUE
#> 21      FALSE
#> 22       TRUE
#> 23       TRUE

SuppressDominantCells(data = dat, 
    dominanceVar = "value",
    numVar = "num2", 
    formula = ~sector2 * geo + sector4 * eu, 
    contributorVar = "company", 
    pPercent = 10,
    intervalVar = c("value","freq", "num2"), 
    rangePercent = c(10, 10, 30), rangeMin = c(1, 0.2222, 2.222))
#> [preAggregate 20*7->20*8]
#> [extraAggregate 20*8->10*8] Checking .....
#> GaussSuppression_numttHTT: .......::::
#>         geo       sector4 freq num2 value rlim_value rlim_freq rlim_num2
#> 1     Total         Total   20  210 462.3         NA        NA        NA
#> 2     Total       private   16  160 429.5         NA        NA        NA
#> 3     Total        public    4   50  32.8         NA        NA        NA
#> 4   Iceland         Total    4   53  37.1       3.71    0.4000    15.900
#> 5  Portugal         Total    8   76 162.5      16.25    0.8000    22.800
#> 6     Spain         Total    8   81 262.7         NA        NA        NA
#> 7     Total   Agriculture    4   10 240.2      24.02    0.4000     3.000
#> 8     Total Entertainment    6   45 131.5         NA        NA        NA
#> 9     Total  Governmental    4   50  32.8         NA        NA        NA
#> 10    Total      Industry    6  105  57.8         NA        NA        NA
#> 11       EU         Total   16  157 425.2         NA        NA        NA
#> 12    nonEU         Total    4   53  37.1       3.71    0.4000    15.900
#> 13  Iceland       private    4   53  37.1       3.71    0.4000    15.900
#> 14 Portugal       private    6   53 138.9      13.89    0.6000    15.900
#> 15    Spain       private    6   54 253.5         NA        NA        NA
#> 16 Portugal        public    2   23  23.6       2.36    0.2222     6.900
#> 17    Spain        public    2   27   9.2       1.00    0.2222     8.100
#> 18       EU   Agriculture    4   10 240.2      24.02    0.4000     3.000
#> 19       EU Entertainment    5   40 114.7         NA        NA        NA
#> 20    nonEU Entertainment    1    5  16.8       1.68    0.2222     2.222
#> 21       EU  Governmental    4   50  32.8         NA        NA        NA
#> 22       EU      Industry    3   57  37.5         NA        NA        NA
#> 23    nonEU      Industry    3   48  20.3         NA        NA        NA
#>    primary suppressed
#> 1    FALSE      FALSE
#> 2    FALSE      FALSE
#> 3    FALSE      FALSE
#> 4     TRUE       TRUE
#> 5     TRUE       TRUE
#> 6    FALSE      FALSE
#> 7     TRUE       TRUE
#> 8    FALSE      FALSE
#> 9    FALSE      FALSE
#> 10   FALSE       TRUE
#> 11   FALSE       TRUE
#> 12    TRUE       TRUE
#> 13    TRUE       TRUE
#> 14    TRUE       TRUE
#> 15   FALSE       TRUE
#> 16    TRUE       TRUE
#> 17    TRUE       TRUE
#> 18    TRUE       TRUE
#> 19   FALSE       TRUE
#> 20    TRUE       TRUE
#> 21   FALSE      FALSE
#> 22   FALSE      FALSE
#> 23   FALSE       TRUE
    

    
## Below are two alternative ways of calculating interval requirements. 
## In these cases, the requirements are generated by the primary suppression 
## functions when the parameter `protectionIntervals = TRUE` is specified.


# See ?MagnitudeRule
SuppressDominantCells(data = dat, 
                      dominanceVar = "value",
                      formula = ~sector2 * geo + sector4 * eu, 
                      contributorVar = "company", 
                      pPercent = 10,
                      protectionIntervals = TRUE)
#> [preAggregate 20*7->20*7]
#> [extraAggregate 20*7->10*7] Checking .....
#> GaussSuppression_numttHTT: .......::::
#>         geo       sector4 freq value lomax_value upmin_value primary suppressed
#> 1     Total         Total   20 462.3          NA          NA   FALSE      FALSE
#> 2     Total       private   16 429.5          NA          NA   FALSE      FALSE
#> 3     Total        public    4  32.8          NA          NA   FALSE      FALSE
#> 4   Iceland         Total    4  37.1       36.36       37.84    TRUE       TRUE
#> 5  Portugal         Total    8 162.5      162.31      162.69    TRUE       TRUE
#> 6     Spain         Total    8 262.7          NA          NA   FALSE      FALSE
#> 7     Total   Agriculture    4 240.2      222.95      257.45    TRUE       TRUE
#> 8     Total Entertainment    6 131.5          NA          NA   FALSE      FALSE
#> 9     Total  Governmental    4  32.8          NA          NA   FALSE      FALSE
#> 10    Total      Industry    6  57.8          NA          NA   FALSE       TRUE
#> 11       EU         Total   16 425.2          NA          NA   FALSE       TRUE
#> 12    nonEU         Total    4  37.1       36.36       37.84    TRUE       TRUE
#> 13  Iceland       private    4  37.1       36.36       37.84    TRUE       TRUE
#> 14 Portugal       private    6 138.9      137.01      140.79    TRUE       TRUE
#> 15    Spain       private    6 253.5          NA          NA   FALSE       TRUE
#> 16 Portugal        public    2  23.6       21.44       25.76    TRUE       TRUE
#> 17    Spain        public    2   9.2        8.55        9.85    TRUE       TRUE
#> 18       EU   Agriculture    4 240.2      222.95      257.45    TRUE       TRUE
#> 19       EU Entertainment    5 114.7          NA          NA   FALSE       TRUE
#> 20    nonEU Entertainment    1  16.8       15.12       18.48    TRUE       TRUE
#> 21       EU  Governmental    4  32.8          NA          NA   FALSE      FALSE
#> 22       EU      Industry    3  37.5          NA          NA   FALSE      FALSE
#> 23    nonEU      Industry    3  20.3          NA          NA   FALSE       TRUE

# See ?PrimaryDefault
SuppressSmallCounts(data = dat, 
                    formula = ~sector2 * geo + sector4 * eu, 
                    maxN = 3,
                    protectionIntervals = TRUE)     
#> [preAggregate 20*7->10*5]
#> [extend0 10*5->12*5]
#> GaussSuppression_anySum: ................
#>         geo       sector4 freq upmin_freq rlim_freq primary suppressed
#> 1     Total         Total   20         NA        NA   FALSE      FALSE
#> 2     Total       private   16         NA        NA   FALSE      FALSE
#> 3     Total        public    4         NA        NA   FALSE      FALSE
#> 4   Iceland         Total    4         NA        NA   FALSE      FALSE
#> 5  Portugal         Total    8         NA        NA   FALSE      FALSE
#> 6     Spain         Total    8         NA        NA   FALSE      FALSE
#> 7     Total   Agriculture    4         NA        NA   FALSE      FALSE
#> 8     Total Entertainment    6         NA        NA   FALSE      FALSE
#> 9     Total  Governmental    4         NA        NA   FALSE      FALSE
#> 10    Total      Industry    6         NA        NA   FALSE      FALSE
#> 11       EU         Total   16         NA        NA   FALSE      FALSE
#> 12    nonEU         Total    4         NA        NA   FALSE      FALSE
#> 13  Iceland       private    4         NA        NA   FALSE       TRUE
#> 14 Portugal       private    6         NA        NA   FALSE       TRUE
#> 15    Spain       private    6         NA        NA   FALSE       TRUE
#> 16  Iceland        public    0          1         2    TRUE       TRUE
#> 17 Portugal        public    2          3         2    TRUE       TRUE
#> 18    Spain        public    2          3         2    TRUE       TRUE
#> 19       EU   Agriculture    4         NA        NA   FALSE       TRUE
#> 20    nonEU   Agriculture    0          1         2    TRUE       TRUE
#> 21       EU Entertainment    5         NA        NA   FALSE       TRUE
#> 22    nonEU Entertainment    1          2         2    TRUE       TRUE
#> 23       EU  Governmental    4         NA        NA   FALSE       TRUE
#> 24    nonEU  Governmental    0          1         2    TRUE       TRUE
#> 25       EU      Industry    3          4         2    TRUE       TRUE
#> 26    nonEU      Industry    3          4         2    TRUE       TRUE
                    
                    
                    
## Combining IntervalLimits arguments 
## with protectionIntervals = TRUE also works

SuppressSmallCounts(data = dat, 
                    formula = ~sector2 * geo + sector4 * eu, 
                    maxN = 3,
                    protectionIntervals = TRUE,
                    protectionPercent = 50)
#> [preAggregate 20*7->10*5]
#> [extend0 10*5->12*5]
#> GaussSuppression_anySum: ................
#>         geo       sector4 freq upmin_freq rlim_freq lomax_freq primary
#> 1     Total         Total   20         NA        NA         NA   FALSE
#> 2     Total       private   16         NA        NA         NA   FALSE
#> 3     Total        public    4         NA        NA         NA   FALSE
#> 4   Iceland         Total    4         NA        NA         NA   FALSE
#> 5  Portugal         Total    8         NA        NA         NA   FALSE
#> 6     Spain         Total    8         NA        NA         NA   FALSE
#> 7     Total   Agriculture    4         NA        NA         NA   FALSE
#> 8     Total Entertainment    6         NA        NA         NA   FALSE
#> 9     Total  Governmental    4         NA        NA         NA   FALSE
#> 10    Total      Industry    6         NA        NA         NA   FALSE
#> 11       EU         Total   16         NA        NA         NA   FALSE
#> 12    nonEU         Total    4         NA        NA         NA   FALSE
#> 13  Iceland       private    4         NA        NA         NA   FALSE
#> 14 Portugal       private    6         NA        NA         NA   FALSE
#> 15    Spain       private    6         NA        NA         NA   FALSE
#> 16  Iceland        public    0        1.0         2        0.0    TRUE
#> 17 Portugal        public    2        3.0         2        1.0    TRUE
#> 18    Spain        public    2        3.0         2        1.0    TRUE
#> 19       EU   Agriculture    4         NA        NA         NA   FALSE
#> 20    nonEU   Agriculture    0        1.0         2        0.0    TRUE
#> 21       EU Entertainment    5         NA        NA         NA   FALSE
#> 22    nonEU Entertainment    1        2.0         2        0.5    TRUE
#> 23       EU  Governmental    4         NA        NA         NA   FALSE
#> 24    nonEU  Governmental    0        1.0         2        0.0    TRUE
#> 25       EU      Industry    3        4.5         2        1.5    TRUE
#> 26    nonEU      Industry    3        4.5         2        1.5    TRUE
#>    suppressed
#> 1       FALSE
#> 2       FALSE
#> 3       FALSE
#> 4       FALSE
#> 5       FALSE
#> 6       FALSE
#> 7       FALSE
#> 8       FALSE
#> 9       FALSE
#> 10      FALSE
#> 11      FALSE
#> 12      FALSE
#> 13       TRUE
#> 14       TRUE
#> 15       TRUE
#> 16       TRUE
#> 17       TRUE
#> 18       TRUE
#> 19       TRUE
#> 20       TRUE
#> 21       TRUE
#> 22       TRUE
#> 23       TRUE
#> 24       TRUE
#> 25       TRUE
#> 26       TRUE