all_geogs_add_constraint: Add new constraint to a set of geographies

View source: R/sim_anneal_wrappers.R

all_geogs_add_constraintR Documentation

Add new constraint to a set of geographies

Description

Add a new constraint to the mapping between a a set of macro datasets and a matching set of micro dataset (supplied as class 'macro_micro'). May be called repeatedly to create a set of constraints across the sub-geographies.

Usage

all_geogs_add_constraint(
  attr_name = "variable",
  attr_total_list,
  macro_micro,
  constraint_list_list = NULL
)

Arguments

attr_name

The name of the attribute, or variable, that you wish to constrain.

attr_total_list

A list of named integer vectors containing counts per level of the new constraining attribute for each geography.

macro_micro

The geographical dataset of macro and micro data. Should be of class "macro_micro".

constraint_list_list

A list of lists containing prior constraints on the same dataset for which you wish to add to. Defaults to NULL (ie. the default is that this is the first constraint.)

Value

A list of constraint lists.

See Also

add_constraint

Examples

## Not run: 
# assumes that micro_synthetic already exists in your environment

# 1. build constraints for gender and age
g <- all_geog_constraint_gender(micro_synthetic, method= "macro.table")

a <- all_geog_constraint_age(micro_synthetic, method= "macro.table")

# 2. bind constraints to geographies and macro-data
cll <- all_geogs_add_constraint(attr_name= "age", attr_total_list= a, 
          macro_micro= micro_synthetic)
cll <- all_geogs_add_constraint(attr_name= "gender", attr_total_list= g, 
          macro_micro= micro_synthetic, constraint_list_list= cll)


## End(Not run)

alexWhitworth/synthACS documentation built on Nov. 2, 2022, 9:14 a.m.