ras: RAS/Deming-Stephan Algorithm for Raking Tables

View source: R/ras.R

rasR Documentation

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.

Details

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

Value

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

Author(s)

Milan Bouchet-Valat


logmult documentation built on March 18, 2022, 7:12 p.m.