ipf2_stripe: iterative proportional fitting routine for the indirect...

View source: R/ipf2_stripe.R

ipf2_stripeR Documentation

iterative proportional fitting routine for the indirect estimation of origin-destination-type migration flow tables with known origin and destination margins and stripe elements.

Description

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

\log y_{pq} = \log \alpha_{p} + \log \beta_{q} + \log \lambda_{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 \lambda_{ij}I(p \in i, q \in j) term ensures a saturated fit on the block the (i,j) block.

Usage

ipf2_stripe(
  row_tot = NULL,
  col_tot = NULL,
  stripe_tot = NULL,
  stripe = 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.

stripe_tot

Matrix of stripe totals to constrain the sum of the imputed cell blocks.

stripe

Matrix of stripe structure corresponding to stripe_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 stripe_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 stripe_tot take the totals over the stripes 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

See Also

stripe_matrix, block_matrix

Examples

y <- ipf2_stripe(row_tot = c(85, 70, 35, 30, 60, 55, 65),
 stripe_tot = matrix(c(15,20,50,
                35,10,25,
                5 ,0 ,30,
                10,10,10,
                30,30,0,
                15,30,10,
                35,25,5 ), ncol = 3, byrow = TRUE),
 stripe = stripe_matrix(x = 1:21, s = c(2,2,3), byrow = TRUE))
 addmargins(y$mu)

migest documentation built on Nov. 18, 2023, 9:06 a.m.