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

Description Usage Arguments See Also Examples

View source: R/sim_anneal_wrappers.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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

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

synthACS documentation built on July 2, 2020, 2:29 a.m.