mod bootstrap_tost;
mod bounds;
mod correlation_tost;
mod proportion_tost;
mod ttest_tost;
mod wilcoxon_tost;
mod yuen_tost;
pub use bootstrap_tost::tost_bootstrap;
pub use bounds::EquivalenceBounds;
pub use correlation_tost::{tost_correlation, CorrelationTostMethod};
pub use proportion_tost::{tost_prop_one, tost_prop_two};
pub use ttest_tost::{tost_t_test_one_sample, tost_t_test_paired, tost_t_test_two_sample};
pub use wilcoxon_tost::{tost_wilcoxon_paired, tost_wilcoxon_two_sample};
pub use yuen_tost::tost_yuen;
#[derive(Debug, Clone)]
pub struct OneSidedTestResult {
pub hypothesis: String,
pub statistic: f64,
pub p_value: f64,
pub rejected: bool,
}
#[derive(Debug, Clone)]
pub struct TostResult {
pub estimate: f64,
pub ci: (f64, f64),
pub bounds: (f64, f64),
pub lower_test: OneSidedTestResult,
pub upper_test: OneSidedTestResult,
pub tost_p_value: f64,
pub equivalent: bool,
pub alpha: f64,
pub n: usize,
pub df: Option<f64>,
pub method: String,
}
impl TostResult {
pub fn is_equivalent(&self) -> bool {
self.equivalent
}
pub fn summary(&self) -> String {
let conclusion = if self.equivalent {
"Equivalence established"
} else {
"Equivalence not established"
};
format!(
"{}: estimate = {:.4}, 90% CI [{:.4}, {:.4}], bounds [{:.4}, {:.4}], TOST p = {:.4}",
conclusion,
self.estimate,
self.ci.0,
self.ci.1,
self.bounds.0,
self.bounds.1,
self.tost_p_value
)
}
}