Description Usage Arguments Value
View source: R/regularize_matrix.R
Regularize a square matrix by manipulating it's diagonal
1 2 3 4 5 6 | regularize_matrix(
matr,
const = 1,
method = c("constant", "avg_diag", "increase_diag"),
only_if_singular = TRUE
)
|
matr |
the matrix to be regularized |
const |
the constant to be used in the regularization |
method |
how to regularize the matrix. can be one of 'constant', 'avg_diag', 'increase_diag'. see details for more information. |
only_if_singular |
if true, will regularize only if the matrix is singular |
if method = 'constant', will add the constant to the diagonal. if method = 'avg_diag', will calculate a weighted average of the original matrix and an identity matrix multiplied by the avregae value of the diagonal, with weights 1 - const and const. if method = 'avg_diag', will calculate a weighted average of the original matrix and the diagonal of the matrix, with weights 1 - const and const
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.