# ipf2_block: Iterative proportional fitting routine for the indirect... In migest: Methods for the Indirect Estimation of Bilateral Migration

## Description

The ipf2.b function finds the maximum likelihood estimates for fitted values in the log-linear model:

\log y_{pq} = \log α_{p} + \log β_{q} + \log λ_{ij}I(p \in i, q \in j) + \log m_{pq}

where m_{pq} is a prior estimate for y_{pq} and is no more complex than the matrices being fitted. The λ_{ij}I(p \in i, q \in j) term ensures a saturated fit on the block the (i,j) block.

## Usage

  1 2 3 4 5 6 7 8 9 10 11 ipf2_block( row_tot = NULL, col_tot = NULL, block_tot = NULL, block = NULL, m = NULL, tol = 1e-05, maxit = 500, verbose = TRUE, ... ) 

## Arguments

 row_tot Vector of origin totals to constrain the sum of the imputed cell rows. col_tot Vector of destination totals to constrain the sum of the imputed cell columns. block_tot Matrix of block totals to constrain the sum of the imputed cell blocks. block Matrix of block structure corresponding to block_tot. m Matrix of auxiliary data. By default set to 1 for all origin-destination combinations. tol Numeric value for the tolerance level used in the parameter estimation. maxit Numeric value for the maximum number of iterations used in the parameter estimation. verbose Logical value to indicate the print the parameter estimates at each iteration. By default FALSE. ... Additional arguments passes to block_matrix.

## Value

Iterative Proportional Fitting routine set up using the partial likelihood derivatives. The arguments row_tot and col_tot take the row-table and column-table specific known margins. The block_tot take the totals over the blocks in the matrix defined with b. Diagonal values can be added by the user, but care must be taken to ensure resulting diagonals are feasible given the set of margins.

The user must ensure that the row and column totals in each table sum to the same value. Care must also be taken to allow the dimension of the auxiliary matrix (m) equal those provided in the row and column totals.

Returns a list object with

 mu  Array of indirect estimates of origin-destination matrices by migrant characteristic it  Iteration count tol  Tolerance level at final iteration

## Author(s)

Guy J. Abel

block_matrix, stripe_matrix, block_sum
 1 2 3 4 5 6 y <- ipf2_block(row_tot= c(30,20,30,10,20,5,0,10,5,5,5,10), col_tot = c(45,10,10,5,5,10,50,5,10,0,0,0), block_tot = matrix(data = c(0,0 ,50,0, 35,0,25,0, 10,10,0,0, 10,10,0,0), nrow = 4, byrow = TRUE), block = block_matrix(x = 1:16, b = c(2,3,4,3))) addmargins(y\$mu)