Calculate the total absolute error (TAE) between sample data and constraints.
Calculate the total absolute error (TAE) between sample data and constraints.
Calculates the total absolute error (TAE) between sample micro data and constraining totals from the matching macro data. Allows for updating of prior TAE instead of re-calculating to improve speed in iterating. The updating feature is particularly helpful for optimizing micro data fitting via simulated annealing (see optimize_microdata).
sample_data: A data.frame with attributes matching constraint_list.
constraint_list: A list of constraints. See add_constraint.
prior_sample_totals: An optional list containing attribute counts of a prior sample corresponding to the constraint list. Defaults to NULL.
dropped_obs_totals: An optional list containing attribute counts from the dropped observations in a prior sample. Defaults to NULL.
new_obs: An optional data.frame containing new observations with attributes matching those in sample_data, constraint_list, and prior_sample_totals. Defaults to NULL.
Examples
## Not run:## assumes that you have a micro_synthetic dataset named test_micro and attribute count## named g respectively c_list <- add_constraint(attr_name="gender", attr_totals= g, micro_data= test_micro, constraint_list= c_list)calculate_TAE(test_micro, c_list)## End(Not run)