Skip to contents

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

synth_pop

A data.table containing the synthetic population.

contingency

A data.frame or data.table containing reference contingency data.

target_attribute

Character string identifying the attribute to be assigned.

group_by

Character vector specifying conditioning variables used during assignment.

margins

Optional list of marginal distributions.

margins_names

Names corresponding to supplied margins.

margins_group

Character vector specifying margins group.

missing_group_strategy

Strategy used to handle groups not present in the contingency table.

warning_threshold

Significance threshold used when generating validation warnings.

validation_results

Validation diagnostics generated by ratify().

Workflow

A typical workflow is:


adder <- ReplicaAdder(...)

adder <- renew(
  adder,
  margins = ...
)

adder <- enhance(adder)

adder <- ratify(adder)

Inheritance

ReplicaAdder inherits from Ready4Module.