sdc_model: Disclosure control for models

View source: R/sdc_model.R

sdc_modelR Documentation

Disclosure control for models


Checks if your model complies to RDC rules. Checks for overall number of entities and number of entities for each level of dummy variables.


sdc_model(data, model, id_var = getOption("sdc.id_var"), fill_id_var = FALSE)



data.frame which was used to build the model.


The estimated model object. Can be a model type like lm, glm and various others (anything which can be handled by broom::augment()).


character The name of the id variable. Defaults to getOption("sdc.id_var") so that you can provide options(sdc.id_var = "my_id_var") at the top of your script.


logical Only for very specific use cases. For example:

  • id_var contains NA values which represent missing values in the sense that there actually exist values identifying the entity but are unknown (or deleted for privacy reasons).

  • id_var contains NA values which result from the fact that an observation features more than one confidential identifier and not all of these identifiers are present in each observation. Examples for such identifiers are the role of a broker in a security transaction or the role of a collateral giver in a credit relationship.

If TRUE, NA values within id_var will internally be filled with <filled_[i]>, assuming that all NA values of id_var can be treated as different small entities for statistical disclosure control purposes. Thus, set TRUE only if this is a reasonable assumption.

Defaults to FALSE.


A list of class sdc_model with detailed information about options, settings, and compliance with the distinct entities criterion.


# Check simple models
model_1 <- lm(y ~ x_1 + x_2, data = sdc_model_DT)
sdc_model(data = sdc_model_DT, model = model_1, id_var = "id")

model_2 <- lm(y ~ x_1 + x_2 + x_3, data = sdc_model_DT)
sdc_model(data = sdc_model_DT, model = model_2, id_var = "id")

model_3 <- lm(y ~ x_1 + x_2 + dummy_3, data = sdc_model_DT)
sdc_model(data = sdc_model_DT, model = model_3, id_var = "id")

sdcLog documentation built on March 20, 2022, 1:06 a.m.