Learn R Programming

GaussSuppression (version 1.3.0)

default_targeting: Default targeting function for SuppressKDisclosure()

Description

Generates a targeting specification for use with SuppressKDisclosure(). The function is actually used internally by KDisclosurePrimary().

Usage

default_targeting(
  crossTable,
  x,
  identifying = NULL,
  sensitive = NULL,
  targeting_include = NULL,
  targeting_exclude = NULL,
  ...
)

Value

A named targeting list. See SuppressKDisclosure().

Arguments

crossTable

A crossTable, possibly extended after applying mc_hierarchies.

x

The model matrix, x, possibly extended after applying mc_hierarchies.

identifying

Specification of information that an intruder may already know. The specification is subject to the same requirements as sensitive below. If not all variables are included, total codes for the missing variables are derived automatically. This requires that the overall total is included as an output row.

sensitive

Specification of information considered unacceptable to disclose. It may be given as a character vector of variable names, a named list with variable names as names and specified codes as values, or a data frame specifying variable combinations. The wildcard characters * and ?, as well as the exclusion operator !, may be used, since SSBtools::WildcardGlobbing() is applied.

targeting_include

A list of two-element lists with components identifying and sensitive. Each element defines identifying–sensitive relations using the same specification rules as the parameters identifying and sensitive. All specifications together, including the main identifying and sensitive parameters, define the relations that are examined for suppression.

targeting_exclude

A list specified in the same way as targeting_include. The relations defined here are ignored when examining suppression.

...

Unused parameters.

Details

The parameters identifying and sensitive are used to select table cells (including hidden cells constructed via mc_hierarchies). All such cells are represented by rows in crossTable, which may be extended due to mc_hierarchies. Thus, rows in crossTable are selected as identifying or sensitive.

In addition, sensitive specifies which codes within the selected rows are regarded as sensitive.

The logic differs slightly for unspecified variables: For identifying, unspecified variables are set to total codes. For sensitive, all rows in crossTable matching the specified variables are selected.

The parameters identifying and sensitive are used to construct the targeting specification for KDisclosurePrimary(), resulting in the elements identifying, sensitive, and is_sensitive.

When targeting_include and/or targeting_exclude are specified, additional elements include_relations and exclude_relations are created.

Examples

Run this code

mm <- SSBtools::ModelMatrix(SSBtoolsData("example1"), 
     formula = ~age * eu + geo, crossTable = TRUE)
crossTable <- mm$crossTable
x <- mm$modelMatrix      

default_targeting(crossTable, x)  # just NULL 

# geo identifying and age sensitive (age sensitive variable)
a2 <- default_targeting(crossTable, x, 
                        identifying = "geo", 
                        sensitive = "age")
a1 <- default_targeting(crossTable, x, 
                        identifying = list(age = "Total", geo = "*"), 
                        sensitive = list(age = "*")) 
identical(a1, a2)
a1                         
                  
                  
# Not ok to disclose 'EU' and 'Portugal'
# But ok to disclose 'Spain' with 'EU' known
# and also ok to disclose 'Spain' in other table cells without 'EU' as marginal  
default_targeting(crossTable, x, 
                  sensitive = list(geo = c("Portugal", "EU")))
                  
# As above but now also ok to disclose 'Portugal' from 'EU' known,
# since protection only considers 'age' identifying.                   
default_targeting(crossTable, x, 
                  identifying = "age",
                  sensitive = list(geo = c("Portugal", "EU")))                 

Run the code above in your browser using DataLab