An S4 class for assigning attributes to synthetic agents using contingency tables and marginal distributions.
Details
ReplicaAdder extends Ready4Module and implements the
attribute-assignment stage of the replica workflow.
The module assigns a target attribute to a synthetic population while attempting to preserve relationships described in a reference contingency table.
Optional marginal distributions may also be supplied when known population totals are available.
Validation diagnostics can be generated using
ratify() and are stored in the
validation_results slot.
Slots
populationA data.table containing the synthetic population.
contingency_tableA data.frame or data.table containing reference contingency data.
target_attributeCharacter string identifying the attribute to be assigned.
group_byCharacter vector specifying conditioning variables used during assignment.
marginsOptional list of marginal distributions.
margins_namesNames corresponding to supplied margins.
margins_groupCharacter vector specifying margins group.
missing_group_strategyStrategy used to handle groups not present in the contingency table.
warning_thresholdSignificance threshold used when generating validation warnings.
validation_resultsValidation diagnostics generated by
ratify().
Workflow
A typical workflow is:
ADDER <- ReplicaAdder(...)
ADDER <- renew(
ADDER,
margins = ...
)
ADDER <- enhance(ADDER)
ADDER <- ratify(ADDER)