h2_threeway {hstats} | R Documentation |
Three-way Interaction Strength
Description
Friedman and Popescu's statistic of three-way interaction strength, see Details.
Use plot()
to get a barplot. In hstats()
, set threeway_m
to a value above 2
to calculate this statistic for all feature triples of the threeway_m
features with strongest overall interaction.
Usage
h2_threeway(object, ...)
## Default S3 method:
h2_threeway(object, ...)
## S3 method for class 'hstats'
h2_threeway(
object,
normalize = TRUE,
squared = TRUE,
sort = TRUE,
zero = TRUE,
...
)
Arguments
object |
Object of class "hstats". |
... |
Currently unused. |
normalize |
Should statistics be normalized? Default is |
squared |
Should squared statistics be returned? Default is |
sort |
Should results be sorted? Default is |
zero |
Should rows with all 0 be shown? Default is |
Details
Friedman and Popescu (2008) describe a test statistic to measure three-way
interactions: in case there are no three-way interactions between features
,
and
, their (centered) three-dimensional partial
dependence function
can be decomposed into lower order terms:
with
and
The squared and scaled difference between the two sides of the equation leads to the statistic
where
and
Similar remarks as for h2_pairwise()
apply.
Value
An object of class "hstats_matrix" containing these elements:
-
M
: Matrix of statistics (one column per prediction dimension), orNULL
. -
SE
: Matrix with standard errors ofM
, orNULL
. Multiply withsqrt(m_rep)
to get standard deviations instead. Currently, supported only forperm_importance()
. -
m_rep
: The number of repetitions behind standard errorsSE
, orNULL
. Currently, supported only forperm_importance()
. -
statistic
: Name of the function that generated the statistic. -
description
: Description of the statistic.
Methods (by class)
-
h2_threeway(default)
: Default pairwise interaction strength. -
h2_threeway(hstats)
: Pairwise interaction strength from "hstats" object.
References
Friedman, Jerome H., and Bogdan E. Popescu. "Predictive Learning via Rule Ensembles." The Annals of Applied Statistics 2, no. 3 (2008): 916-54.
See Also
hstats()
, h2()
, h2_overall()
, h2_pairwise()
Examples
# MODEL 1: Linear regression
fit <- lm(uptake ~ Type * Treatment * conc, data = CO2)
s <- hstats(fit, X = CO2[, 2:4], threeway_m = 5)
h2_threeway(s)
#' MODEL 2: Multivariate output (taking just twice the same response as example)
fit <- lm(cbind(up = uptake, up2 = 2 * uptake) ~ Type * Treatment * conc, data = CO2)
s <- hstats(fit, X = CO2[, 2:4], threeway_m = 5)
h2_threeway(s)
h2_threeway(s, normalize = FALSE, squared = FALSE) # Unnormalized H
plot(h2_threeway(s))