ipf: Multidimensional IPF

View source: R/RcppExports.R

ipfR Documentation

Multidimensional IPF

Description

C++ multidimensional IPF implementation

Usage

ipf(seed, indices, marginals)

Arguments

seed

an n-dimensional array of seed values

indices

a List of 1-d arrays specifying the dimension indices of each marginal as they apply to the seed values

marginals

a List of arrays containing marginal data. The sum of elements in each array must be identical

Value

an object containing:

  • a flag indicating if the solution converged

  • the population matrix

  • the total population

  • the number of iterations required

  • the maximum error between the generated population and the marginals

Examples

ageByGender = array(c(1,2,5,3,4,3,4,5,1,2), dim=c(5,2))
ethnicityByGender = array(c(4,6,5,6,4,5), dim=c(3,2))
seed = array(rep(1,30), dim=c(5,2,3))
result = ipf(seed, list(c(1,2), c(3,2)), list(ageByGender, ethnicityByGender))

humanleague documentation built on April 18, 2023, 1:09 a.m.

Related to ipf in humanleague...