Reorders a square matrix so that values of high importance and interaction strength are pushed to the top left of the matrix.

vividReorder(d)

Arguments

d

A matrix such as that returned by vivi

Value

A reordered version of d.

Examples

f <- lm(Sepal.Length ~ ., data = iris[, -5])
m <- vivi(fit = f, data = iris[, -5], response = "Sepal.Length")
#> Agnostic variable importance method used.
#> Calculating interactions...
corimp <- abs(cor(iris[, -5])[1, -1])
viviUpdate(m, corimp) # use correlation as importance and reorder
#>              Petal.Width Petal.Length Sepal.Width
#> Petal.Width    0.8179411    0.0000000   0.0000000
#> Petal.Length   0.0000000    0.8717538   0.0000000
#> Sepal.Width    0.0000000    0.0000000   0.1175698
#> attr(,"class")
#> [1] "vivid"  "matrix" "array"