bpci
Binomial proportion confidence intervals.
```rust use bpci::NSuccessesSample;
fn main() { // 10 successes out of 20 trials: let sample = NSuccessesSample::new(20, 10).unwrap(); } ```
```rust use bpci::PHatSample;
fn main() { // 20 trials with 0.5 success rate: let sample = PHatSample::new(20, 0.5).unwrap(); } ```
```rust use bpci::*; use approx::assertrelativeeq;
fn main() { let sample = PHatSample::new(100, 0.25).unwrap(); let interval = sample.wilsonscore(1.960); // 95% assertrelativeeq!(interval.lower(), 0.1754509400372426); assertrelative_eq!(interval.upper(), 0.3430464637007583); } ```
```rust use bpci::*; use approx::assertrelativeeq;
fn main() { let sample = PHatSample::new(100, 0.25).unwrap(); let interval = sample.wilsonscorewithcc(1.960); // 95% assertrelativeeq!(interval.lower(), 0.17117438961361867); assertrelative_eq!(interval.upper(), 0.34838596518606424); } ```
```rust use bpci::*; use approx::assertrelativeeq;
fn main() { let sample = PHatSample::new(40, 0.25).unwrap(); let interval = sample.agresticoull(1.960); // 95% assertrelativeeq!(interval.mean, 0.2719061348125981); assertrelative_eq!(interval.margin, 0.1317091851034039); } ```
```rust use bpci::*; use approx::assertrelativeeq;
fn main() { let sample = PHatSample::new(100, 0.3).unwrap(); let interval = sample.wald(1.960); // 95% assertrelativeeq!(interval.lower(), 0.2101815163788655); assertrelativeeq!(interval.upper(), 0.38981848362113447); } ```