logmult (version 0.7.0)

ras: RAS/Deming-Stephan Algorithm for Raking Tables

Description

Adjust a table by multiplying rows and columns in order to reproduce the provided margins, preserving all the odds ratios. This procedure is know as the RAS or Deming-Stephan algorithm, as iterative proportional fitting (IPF) or as biproportional fitting.

Usage

ras(tab, row, col, tolerance = .Machine$double.eps)

Arguments

tab

a two-way table with only positive or zero entries

row

a vector of strictly positive elements containing the wanted row margins (sums).

col

a vector of strictly positive elements containing the wanted column margins (sums).

tolerance

the convergence criterion to stop iterating.

Value

The adjusted table with row sums equal to row and column sums equal to col.

Details

Note that sum(row) must be equal to sum(col) for the algorithm to make sense.