Use standard square bracket subsetting to select rows and/or columns of statistics "M" (and "SE" in case of permutation importance statistics). Implies head() and tail().

# S3 method for class 'hstats_matrix'
x[i, j, ...]

Arguments

x

An object of class "hstats_matrix".

i

Row subsetting.

j

Column subsetting.

...

Currently unused.

Value

A new object of class "hstats_matrix".

Examples

fit <- lm(as.matrix(iris[1:2]) ~ Petal.Length + Petal.Width * Species, data = iris)
imp <- perm_importance(fit, X = iris, y = c("Sepal.Length", "Sepal.Width"))
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |======================================================================| 100%
head(imp, 1)
#> Permutation importance
#> Sepal.Length  Sepal.Width 
#>     5.713499     0.121263 
tail(imp, 2)
#> Permutation importance
#>             Sepal.Length Sepal.Width
#> Species        2.4033697   1.8682923
#> Petal.Width    0.1068958   0.5531304
imp[1, "Sepal.Length"]
#> Permutation importance
#> [1] 5.713499
imp[1]
#> Permutation importance
#> Sepal.Length  Sepal.Width 
#>     5.713499     0.121263 
imp[, "Sepal.Width"]$SE
#>              Sepal.Width
#> Petal.Length 0.005172852
#> Species      0.096119000
#> Petal.Width  0.031615338
plot(imp[, "Sepal.Width"])