use serde::{Deserialize, Serialize};
use super::effect_analysis::{EffectSize, ConfidenceInterval};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PairwiseComparison {
pub group_a: String,
pub group_b: String,
pub t_test: TTestResult,
pub mann_whitney: MannWhitneyResult,
pub welch_test: WelchTestResult,
pub effect_size: EffectSize,
pub difference_ci: ConfidenceInterval,
pub is_significant: bool,
pub is_practically_significant: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TTestResult {
pub t_statistic: f64,
pub degrees_of_freedom: f64,
pub p_value: f64,
pub test_type: TTestType,
pub significant: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TTestType {
OneSample,
TwoSampleEqual, TwoSampleUnequal, Paired,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MannWhitneyResult {
pub u_statistic: f64,
pub z_score: f64,
pub p_value: f64,
pub significant: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WelchTestResult {
pub t_statistic: f64,
pub degrees_of_freedom: f64,
pub p_value: f64,
pub significant: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AnovaResult {
pub f_statistic: f64,
pub df_between: f64,
pub df_within: f64,
pub ss_between: f64,
pub ss_within: f64,
pub ms_between: f64,
pub ms_within: f64,
pub p_value: f64,
pub significant: bool,
pub post_hoc: Option<PostHocTest>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PostHocTest {
pub method: PostHocMethod,
pub comparisons: Vec<PostHocComparison>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PostHocMethod {
Tukey,
Bonferroni,
Holm,
Duncan,
StudentNewmanKeuls,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PostHocComparison {
pub group_a: String,
pub group_b: String,
pub mean_difference: f64,
pub adjusted_p_value: f64,
pub significant: bool,
}