A function for standardizing a matrix in a symmetric
fashion. Generalizes the `scale`

function in R. Works with
matrices with NAs, matrices of class "Incomplete", and matrix in
"sparseMatrix" format.

1 2 |

`x` |
matrix, possibly with NAs, also of class "Incomplete" or "sparseMatrix" format. |

`maxit` |
When both row and column centering/scaling is requested, iteration is may be necessary |

`thresh` |
Convergence threshold |

`row.center` |
if |

`row.scale` |
if |

`col.center` |
Similar to |

`col.scale` |
Similar to |

`trace` |
with |

This function computes a transformation

*\frac{X_{ij}-α_i-β_j}{γ_iτ_j}*

to transform the matrix *X*. It uses an iterative algorithm based
on "method-of-moments". At each step, all but one of the parameter
vectors is fixed, and the remaining vector is computed to solve the
required condition. Although in genereal this is not guaranteed to
converge,
it mostly does, and quite rapidly. When there are convergence
problems, remove some of the required constraints. When any of the
row/column centers or scales are provided, they are used rather than
estimated in the above model.

A matrix like `x`

is returned, with attributes:

`biScale:row` |
a list with elements |

`biScale:column` |
Same details as |

For matrices with missing values, the constraints apply to the
non-missing entries. If `x`

is of class `"sparseMatrix"`

,
then the sparsity is maintained, and an object of class
`"SparseplusLowRank"`

is returned, such that the low-rank part
does the centering.

This function will be described in detail in a forthcoming paper

Trevor Hastie, with help from Andreas Buja and Steven Boyd

,
Maintainer: Trevor Hastie hastie@stanford.edu

`softImpute`

,`Incomplete`

,`lambda0`

,`impute`

,`complete`

,
and class `"SparseplusLowRank"`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
set.seed(101)
n=200
p=100
J=50
np=n*p
missfrac=0.3
x=matrix(rnorm(n*J),n,J)%*%matrix(rnorm(J*p),J,p)+matrix(rnorm(np),n,p)/5
xc=biScale(x)
ix=seq(np)
imiss=sample(ix,np*missfrac,replace=FALSE)
xna=x
xna[imiss]=NA
xnab=biScale(xna,row.scale=FALSE,trace=TRUE)
xnaC=as(xna,"Incomplete")
xnaCb=biScale(xnaC)
nnz=trunc(np*.3)
inz=sample(seq(np),nnz,replace=FALSE)
i=row(x)[inz]
j=col(x)[inz]
x=rnorm(nnz)
xS=sparseMatrix(x=x,i=i,j=j)
xSb=biScale(xS)
class(xSb)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.