pub struct AlphaInvestor { /* private fields */ }Expand description
Alpha-Investing controller for sequential FDR control.
Maintains a wealth process that gates alert significance decisions.
Each call to test either rejects (discovery)
or fails to reject, updating the wealth accordingly.
Implementations§
Source§impl AlphaInvestor
impl AlphaInvestor
Sourcepub fn new(config: AlphaInvestingConfig) -> Self
pub fn new(config: AlphaInvestingConfig) -> Self
Create a new investor with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create an investor with default configuration.
Sourcepub fn discoveries(&self) -> usize
pub fn discoveries(&self) -> usize
Number of discoveries (rejected hypotheses).
Sourcepub fn discovery_rate(&self) -> f64
pub fn discovery_rate(&self) -> f64
Empirical false discovery proportion: discoveries / tests_run. Returns 0.0 if no tests have been run.
Sourcepub fn test(&mut self, p_value: f64) -> TestOutcome
pub fn test(&mut self, p_value: f64) -> TestOutcome
Test a hypothesis with the given p-value.
The procedure invests investment_fraction * wealth as the alpha
level for this test. If p_value ≤ alpha, the hypothesis is rejected
(discovery) and wealth is replenished by reward_fraction * alpha.
Returns the outcome and updates internal state.
Sourcepub fn test_with_investment(
&mut self,
p_value: f64,
custom_alpha: Option<f64>,
) -> TestOutcome
pub fn test_with_investment( &mut self, p_value: f64, custom_alpha: Option<f64>, ) -> TestOutcome
Test with a custom investment amount (overrides investment_fraction).
custom_alpha is clamped to [0, current_wealth].
Sourcepub fn test_batch(&mut self, p_values: &[f64]) -> Vec<TestOutcome>
pub fn test_batch(&mut self, p_values: &[f64]) -> Vec<TestOutcome>
Batch-test multiple hypotheses, returning outcomes for each.
P-values are tested in the order given. The wealth evolves sequentially, so ordering matters.
Sourcepub fn history(&self) -> &[TestRecord]
pub fn history(&self) -> &[TestRecord]
Access the test history.
Sourcepub fn drain_history(&mut self) -> Vec<TestRecord>
pub fn drain_history(&mut self) -> Vec<TestRecord>
Drain the test history (returns ownership, clears internal log).
Trait Implementations§
Source§impl Clone for AlphaInvestor
impl Clone for AlphaInvestor
Source§fn clone(&self) -> AlphaInvestor
fn clone(&self) -> AlphaInvestor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more