all_geog_optimize_microdata: Optimize the selection of a micro data population for a set...

View source: R/sim_anneal_wrappers.R

all_geog_optimize_microdataR Documentation

Optimize the selection of a micro data population for a set of geographies.

Description

Optimize the candidate micro datasets such that the lowest loss against the macro dataset constraints are obtained. Loss is defined here as total absolute error (TAE) and constraints are defined by the constraint_list_list. Optimization is done by simulated annealing and geographies are run in parallel.

Usage

all_geog_optimize_microdata(
  macro_micro,
  prob_name = "p",
  constraint_list_list,
  p_accept = 0.4,
  max_iter = 10000L,
  seed = sample.int(10000L, size = 1, replace = FALSE),
  leave_cores = 1L,
  verbose = TRUE
)

Arguments

macro_micro

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

prob_name

It is assumed that observations are weighted and do not have an equal probability of occurance. This string specifies the variable within each dataset that contains the probability of selection.

constraint_list_list

A list of constraint lists. See add_constraint, all_geogs_add_constraint

p_accept

The acceptance probability for the Metropolis acceptance criteria.

max_iter

The maximum number of allowable iterations. Defaults to 10000L

seed

A seed for reproducibility. See set.seed

leave_cores

An integer for the number of cores you wish to leave open for other processing.

verbose

Logical. Do you wish to see verbose output? Defaults to TRUE

See Also

optimize_microdata

Examples

## Not run: 
 # assumes that micro_synthetic and cll already exist in your environment
 # see: examples for derive_synth_datasets() and all_geogs_add_constraint()
 optimized_la <- all_geog_optimize_microdata(micro_synthetic, prob_name= "p", 
     constraint_list_list= cll, p_accept= 0.01, max_iter= 1000L)

## End(Not run)

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