rescale_table: Rescale table given column and row sums and initial table

Description Usage Arguments Value Examples

Description

Rescales table so that the result has the supplied column and row sums. The matrix must have positive elements in first row and column and nonnegative elements elsewhere.

Usage

1
rescale_table(initM, col_sums, row_sums, ...)

Arguments

initM

the initial matrix

col_sums

the vector of column sums

row_sums

the vector of row sums

...

additional arguments to nleqlsv

Value

a list with the following elements

table

a recovered table

opt

a result of nleqslv

Examples

1
2
3
4
5
6
7
8
set.seed(10)
m <- matrix(runif(9),3)
ma <- m + matrix(runif(9),3)/20
res <- rescale_table(ma, colSums(m), rowSums(m))
res$table - m
ma[3,3] <- 0
res <- rescale_table(ma, colSums(m), rowSums(m))
res$table

mpiktas/retacoro documentation built on May 23, 2019, 6:32 a.m.