ipf.2d: Applies Iterative Proportional Fitting on a 2d dataframe

Description Usage Arguments Details Value Author(s)

Description

Takes as inputs a dataframe representing a 2d matrix, and target marings for cols and rows. Returns a table reweighted so its sums fit margins.

Usage

1
2
ipf.2d(df, margins_cols, margins_rows, max.iterations = 1000,
  precision = 1e-10, verbose = FALSE)

Arguments

df

the dataframe to reweight

margins_cols

a vector containing the target marginals for cols

margins_rows

a vector containing the target marginals for rows

max.iterations

the maximum iterations before stopping (1000 by default)

precision

the target precision, will stop once reached (defaults to 1e-6)

verbose

displays more messages if TRUE (FALSE by default)

Details

Either falls back to a local implementation ipf.2d.stackoverflow, or to an higher quality one from the mipfp package if it is installed.

Value

the dataframe reweighted

Author(s)

Samuel Thiriot <samuel.thiriot@res-ear.ch>


samthiriot/gosp.dpp documentation built on May 18, 2019, 3:44 p.m.