Skip to main content

Module hypothesis

Module hypothesis 

Source
Expand description

Statistical Hypothesis Testing

Implements classical hypothesis tests for comparing distributions and testing relationships.

§Tests

  • t-tests: Compare means (one-sample, two-sample, paired)
  • chi-square: Test categorical distributions (goodness-of-fit, independence)
  • ANOVA: Compare multiple group means (F-test)

§Example

use aprender::stats::hypothesis::{ttest_ind, TTestResult};

let group1 = vec![2.3, 2.5, 2.7, 2.9, 3.1];
let group2 = vec![3.2, 3.4, 3.6, 3.8, 4.0];

let result = ttest_ind(&group1, &group2, true).unwrap();
println!("t-statistic: {:.4}, p-value: {:.4}", result.statistic, result.pvalue);

Structs§

AnovaResult
Result of an ANOVA F-test.
ChiSquareResult
Result of a chi-square test.
TTestResult
Result of a t-test.

Functions§

chisquare
Chi-square goodness-of-fit test: Tests if observed frequencies match expected.
f_oneway
One-way ANOVA: Tests if multiple groups have the same mean.
ttest_1samp
One-sample t-test: Tests if sample mean differs from population mean.
ttest_ind
Independent two-sample t-test: Tests if two independent samples have different means.
ttest_rel
Paired t-test: Tests if paired samples have different means.