Creates a matrix displaying updated variable importance on the diagonal and variable interaction on the off-diagonal.

viviUpdate(mat, newImp, reorder = TRUE)

Arguments

mat

A matrix, such as that returned by vivi.

newImp

A named vector of variable importances.

reorder

If TRUE (default) uses DendSer to reorder the matrix of interactions and variable importances.

Value

A matrix of values, of class vivid, with updated variable importances.

Examples

f <- lm(Sepal.Length ~ ., data = iris[, -5])
m <- vivi(iris[, -5], f, "Sepal.Length")
#> Agnostic variable importance method used.
#> Calculating interactions...
corimp <- abs(cor(iris[, -5])[1, -1])
viviUpdate(m, corimp) # use correlation as updated importance
#>              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"