pub fn calculate_reject_probability(
    statistic: f64,
    n1: usize,
    n2: usize,
) -> Result<f64, TestError> {
    // Only supports samples of size > 7.
    if n1 < 8 || n2 < 8 {
        return Err(TestError::SequenceHasFewerThanEightElements);
    }

    let n1 = n1 as f64;
    let n2 = n2 as f64;

    let factor = ((n1 * n2) / (n1 + n2)).sqrt();
    let term = (factor + 0.12 + 0.11 / factor) * statistic;

    let reject_probability = 1.0 - probability_kolmogorov_smirnov(term)?;
    if !(0.0..=1.0).contains(&reject_probability) {
        return Err(
            TestError::InvalidEstimatedKolmogorovSmirnovProbabilityFunctionValue {
                lambda: term,
                value: reject_probability,
            },
        );
    }
    Ok(reject_probability)
}
/// Calculate the probability that the null hypothesis is false for a two sample
/// Kolmogorov-Smirnov test. Can only reject the null hypothesis if this
/// evidence exceeds the confidence level required.
Calculate the probability that the null hypothesis is false for a two sample
Kolmogorov-Smirnov test. Can only reject the null hypothesis if this
evidence exceeds the confidence level required.
Calculate the probability that the null hypothesis is false for a two sample Kolmogorov - Smirnov test . Can only reject the null hypothesis if this evidence exceeds the confidence level required .
pub fn calculate_reject_probability(
    statistic: f64,
    n1: usize,
    n2: usize,
) -> Result<f64, TestError> {
    // Only supports samples of size > 7.
    if n1 < 8 || n2 < 8 {
        return Err(TestError::SequenceHasFewerThanEightElements);
    }
    let n1 = n1 as f64;
    let n2 = n2 as f64;
    let factor = ((n1 * n2) / (n1 + n2)).sqrt();
    let term = (factor + 0.12 + 0.11 / factor) * statistic;
    let reject_probability = 1.0 - probability_kolmogorov_smirnov(term)?;
    if !(0.0..=1.0).contains(&reject_probability) {
        return Err(
            TestError::InvalidEstimatedKolmogorovSmirnovProbabilityFunctionValue {
                lambda: term,
                value: reject_probability,
            },
        );
    }
    Ok(reject_probability)
}
pub fn calculate_reject_probability ( statistic : f64 , n1 : usize , n2 : usize , ) -> Result < f64 , TestError > { // Only supports samples of size > 7. if n1 < 8 || n2 < 8 { return Err ( TestError :: SequenceHasFewerThanEightElements ) ; } let n1 = n1 as f64 ; let n2 = n2 as f64 ; let factor = ( ( n1 * n2 ) / ( n1 + n2 ) ) . sqrt ( ) ; let term = ( factor + 0.12 + 0.11 / factor ) * statistic ; let reject_probability = 1.0 - probability_kolmogorov_smirnov ( term ) ? ; if ! ( 0.0 ..= 1.0 ) . contains ( & reject_probability ) { return Err ( TestError :: InvalidEstimatedKolmogorovSmirnovProbabilityFunctionValue { lambda : term , value : reject_probability , } , ) ; } Ok ( reject_probability ) }
Calculate the probability that the null hypothesis is false for a two sample
Kolmogorov-Smirnov test.
Calculate the probability that the null hypothesis is false for a two sample Kolmogorov - Smirnov test .
statistic
f64
n1
usize
n2
usize
statistic
f64
n1
usize
n2
usize