ipf: Re-weight a Seed Table to Marginal Controls

Description Usage Arguments Value

View source: R/ipf.R

Description

Re-weight a Seed Table to Marginal Controls

Usage

1
2
3
4
5
6
7
8
9
ipf(
  seed,
  targets,
  relative_gap = 0.01,
  absolute_gap = 1,
  max_iterations = 50,
  min_weight = 1e-04,
  verbose = FALSE
)

Arguments

seed

A data frame including a weight field and necessary columns for matching to marginal targets.

targets

A named list of data frames. Each name in the list defines a marginal dimension and must match a column from the seed table. The data frame associated with each name must start with an identical column named cluster. Each row in the target table defines a new cluster (these could be TAZs, tracts, districts, etc.), and every target table must have the same number of rows/clusters. The other column names define the marginal categories that targets are provided for.

relative_gap

target for convergence. Maximum percent change to allow any seed weight to move by while considering the process converged. By default, if no weights change by more than 1 The process is said to be converged if either relative_gap or absolute_gap parameters have been met.

absolute_gap

target for convergence. Maximum absolute change to allow any seed weight to move by while considering the process converged. By default, if no weights change by more than 10, the process has converged. The process is said to be converged if either relative_gap or absolute_gap parameters have been met.

max_iterations

maximum number of iterations to perform, even if convergence is not reached.

min_weight

Minimum weight to allow in any cell to prevent zero weights. Set to .0001 by default. Should be arbitrarily small compared to your seed table weights.

verbose

Print details on the maximum expansion factor with each iteration? Default FALSE.

Value

the seed data frame with a column of weights appended for each row in the target data.frames


ipfr documentation built on April 2, 2020, 1:12 a.m.