History
IPF has been "re-invented" many times, the earliest by Kruithof in 1937 in relation to telephone traffic ("Kruithof’s double factor method"), Deming andBiproportion
Biproportion, whatever the algorithm used to solve it, is the following concept: , matrix and matrix are known real nonnegative matrices of dimension ; the interior of is unknown and is searched such that has the same margins than , i.e. and ( being the sum vector, and such that is closed to following a given criterion, the fitted matrix being of the form , where and are diagonal matrices. s.t., ∀ and , ∀. The Lagrangian is . Thus , for ∀, which, after posing and , yields , ∀, i.e., , with , ∀ and , ∀. and form a system that can be solve iteratively: , ∀ and , ∀. The solution is independent of the initialization chosen (i.e., we can begin by , ∀ or by, ∀. If the matrix is “indecomposable”, then this process has a unique fixed-point because it is deduced from program a program where the function is a convex and continuously derivable function defined on a compact set. In some cases the solution may not exist: see de Mesnard's example cited by Miller and Blair (Miller R.E. & Blair P.D. (2009) Input-output analysis: Foundations and Extensions, Second edition, Cambridge (UK): Cambridge University Press, p. 335-336 (freely available)). Some properties (see de Mesnard (1994)): Lack of information: if brings no information, i.e., , ∀ then . Idempotency: if has the same margins than . Composition of biproportions: ; . Zeros: a zero in is projected as a zero in . Thus, a bloc-diagonal matrix is projected as a bloc-diagonal matrix and a triangular matrix is projected as a triangular matrix. Theorem of separable modifications: if is premutiplied by a diagonal matrix and/or postmultiplied by a diagonal matrix, then the solution is unchanged. Theorem of "unicity": If is any non-specified algorithm, with , and being unknown, then and can always be changed into the standard form of and . The demonstrations calls some above properties, particularly the Theorem of separable modifications and the composition of biproportions.Algorithm 1 (classical IPF)
Given a two-way (''I'' × ''J'')-table , we wish to estimate a new table for all ''i'' and ''j'' such that the marginals satisfy and . Choose initial values , and for set : : Repeat these steps until row and column totals are sufficiently close to u and v. Notes: * For the RAS form of the algorithm, define the diagonalization operator , which produces a (diagonal) matrix with its input vector on the main diagonal and zero elsewhere. Then, for each row adjustment, let , from which . Similarly each column adjustment's , from which . Reducing the operations to the necessary ones, it can easily be seen that RAS does the same as classical IPF. In practice, one would not implement actual matrix multiplication with the whole R and S matrices; the RAS form is more a notational than computational convenience.Algorithm 2 (factor estimation)
Assume the same setting as in the classical IPFP. Alternatively, we can estimate the row and column factors separately: Choose initial values , and for set : : Repeat these steps until successive changes of a and b are sufficiently negligible (indicating the resulting row- and column-sums are close to u and v). Finally, the result matrix is Notes: * The two variants of the algorithm are mathematically equivalent, as can be seen by formal induction. With factor estimation, it is not necessary to actually compute each cycle's . * The factorization is not unique, since it is for all .Discussion
The vaguely demanded 'similarity' between M and X can be explained as follows: IPFP (and thus RAS) maintains the crossproduct ratios, i.e. : since This property is sometimes called structure conservation and directly leads to the geometrical interpretation of contingency tables and the proof of convergence in the seminal paper of Fienberg (1970). Direct factor estimation (algorithm 2) is generally the more efficient way to solve IPF: Whereas a form of the classical IPFP needs : elementary operations in each iteration step (including a row and a column fitting step), factor estimation needs only : operations being at least one order in magnitude faster than classical IPFP. IPFP can be used to estimate expected quasi-independent (incomplete) contingency tables, with , and for included cells and for excluded cells. For fully independent (complete) contingency tables, estimation with IPFP concludes exactly in one cycle.Comparison with the NM-method
Similar to the IPF, the NM-method is also an operation of finding a matrix which is the “closest” to matrix () while its row totals and column totals are identical to those of a target matrix . However, there are differences between the NM-method and the IPF. For instance, the NM-method defines closeness of matrices of the same size differently from the IPF. Also, the NM-method was developed to solve for matrix in problems, where matrix is not a sample from the population characterized by the row totals and column totals of matrix , but represents another population. In contrast, matrix is a sample from this population in problems where the IPF is applied as theExistence and uniqueness of MLEs
Necessary and sufficient conditions for the existence and uniqueness of MLEs are complicated in the general case (see), but sufficient conditions for 2-dimensional tables are simple: * the marginals of the observed table do not vanish (that is, ) and * the observed table is inseparable (i.e. the table does not permute to a block-diagonal shape). If unique MLEs exist, IPFP exhibits linear convergence in the worst case (Fienberg 1970), but exponential convergence has also been observed (Pukelsheim and Simeone 2009). If a direct estimator (i.e. a closed form of ) exists, IPFP converges after 2 iterations. If unique MLEs do not exist, IPFP converges toward the so-called ''extended MLEs'' by design (Haberman 1974), but convergence may be arbitrarily slow and often computationally infeasible. If all observed values are strictly positive, existence and uniqueness of MLEs and therefore convergence is ensured.Example
Consider the following table, given with the row- and column-sums and targets. For executing the classical IPFP, we first adjust the rows: The first step exactly matched row sums, but not the column sums. Next we adjust the columns: Now the column sums exactly match their targets, but the row sums no longer match theirs. After completing three cycles, each with a row adjustment and a column adjustment, we get a closer approximation:Implementation
The R package mipfp (currently in version 3.1) provides a multi-dimensional implementation of the traditional iterative proportional fitting procedure. The package allows the updating of a ''N''-dimensional array with respect to given target marginal distributions (which, in turn can be multi-dimensional). Python has an equivalent package, ipfn that can be installed via pip. The package supports numpy and pandas input objects.See also
* Data cleansing * Data editing * NM-method *References
{{DEFAULTSORT:Iterative Proportional Fitting Contingency table Statistical algorithms