# Crate behrens_fisher

source · [−]## Expand description

A crate for testing whether the means of two Normal distributions are the same.

This crate implements Welch’s t-test, an approximate solution to the Behrens-Fisher problem. The results are presented in the form of a confidence interval.

### Example

Suppose we have a population distributed as `X`

(normal), and another
distributed as `Y`

(also normal, but possibly with different mean/variance to
`X`

). Let’s take a sample from each population to estimate the difference
between the population means.

```
use behrens_fisher::*;
let x_sample: Vec<f64> = vec![1., 2., 3., 4.];
let y_sample: Vec<f64> = vec![3., 5., 7., 9., 11.];
let x_stats: SampleStats = x_sample.into_iter().collect();
let y_stats: SampleStats = y_sample.into_iter().collect();
let ci = difference_of_means(0.95, x_stats, y_stats).unwrap();
assert_eq!(ci.to_string(), "+4.50 ± 3.89 (p=95%)");
// Looks like μ[Y] > μ[X]!
```

## Modules

## Structs

## Enums

## Functions

An estimate of `μ_y - μ_x`

(the difference in population means),
based on samples taken from X and Y.

An estimate of μ_x (the population mean), based on a sample taken from X.