Calculate the total absolute error (TAE) between sample data and constraints.

Description

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).

Usage

1
2
calculate_TAE(sample_data, constraint_list, prior_sample_totals = NULL,
  dropped_obs_totals = NULL, new_obs = NULL)

Arguments

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

1
2
3
4
5
6
7
8
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.