ras | R Documentation |
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.
ras(tab, row, col, tolerance = .Machine$double.eps)
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. |
Note that sum(row)
must be equal to sum(col)
for the algorithm to make sense.
The adjusted table with row sums equal to row
and column sums equal to col
.
Milan Bouchet-Valat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.