[R] Iterative Proportional Fitting, use

Koen Hufkens koen.hufkens at ua.ac.be
Mon Mar 23 13:13:11 CET 2009


Hi list,

I would like to normalize a matrix (two actually for comparison) using
iterative proportional fitting.

Using ipf() would be the easiest way to do this, however I can't get my
head around the use of the function. More specifically, the margins
settings...

for a matrix:

mat <- matrix(c(65,4,22,24,6,81,5,8,0,11,85,19,4,7,3,90),4,4)

using

fit <- ipf(mat,margins=c(1,1,1,1,0,1,1,1,1))

generates a matrix with just 1's.

using


fit <- ipf(mat,margins=c(100,100,100,100,0,100,100,100,100))

gives a segmentation fault and crashes R !

so how do you define the margin values to which to sum the row and
column values in your matrix correctly?

Kind regards,
Koen




More information about the R-help mailing list