fienberg | R Documentation |
Fienberg rebalancing for two vectors with a given starting matrix
fienberg(start_mat, target_from, target_to)
start_mat |
An |
target_from |
An |
target_to |
An Implements a specific version of the iterative proportional fitting algorithm.
Given an |
The rebalanced n
by n
matrix start_mat
.
set.seed(123)
n = 10
vec0 = runif(n) * 10
vec1 = runif(n); vec1 = vec1 / sum(vec1) * sum(vec0)
matA = diag(n) + 10^-8; matA = matA / rowSums(matA)
res = fienberg(start_mat=matA,target_from=vec0,target_to=vec1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.