
Tidy a kernR Test Result Into a One-Row-Per-Term Data Frame
Source:R/tidy.R
tidy.kernel_test_result.RdTurns a kernR verdict object into a flat, broom-style summary
data.frame: one row per tested term, with stable, documented columns. The
method is registered against the tidy() generic (re-exported by broom),
so broom::tidy(result) and generics::tidy(result) both dispatch here.
Usage
# S3 method for class 'kernel_test_result'
tidy(x, ...)Arguments
- x
A
kernel_test_result(the class returned byhsic_test(),mmd_test(),bd_hsic_test(), and friends) or a subclass such asmmd_ppc.- ...
Currently unused; present for generic compatibility.
Value
A one-row data.frame with columns:
- term
Character. The quantity tested – the test
method(for example"bd-HSIC","MMD").- statistic
Numeric. The observed test statistic.
- p.value
Numeric. The permutation p-value. Note the
broom-canonical dot, distinct from the result's nativep_valuefield.- n
Integer. The sample size the statistic was computed on.
- n_permutations
Integer. Number of permutations in the null.
- ess
Numeric. Effective sample size of the importance weights, or
NAfor unweighted tests.
Subclasses contribute extra columns where they carry extra fields: an
mmd_ppc result adds surprise_bits and reject.
Details
This is the supported accessor for downstream code. Reaching into the result
list by field name is fragile: kernR's native field is p_value (with an
underscore), whereas the broom convention – followed here – is p.value
(with a dot). Use tidy() and read p.value rather than guessing at the
raw field name.