pub struct ConfidenceInterval95 {
pub lower: f64,
pub upper: f64,
}Expand description
A symmetric 95 % confidence interval around a proportion.
Fields§
§lower: f64Lower bound (clipped to 0).
upper: f64Upper bound (clipped to 1).
Implementations§
Source§impl ConfidenceInterval95
impl ConfidenceInterval95
Sourcepub fn wilson(successes: usize, n: usize) -> Self
pub fn wilson(successes: usize, n: usize) -> Self
Compute a Wilson-score 95 % confidence interval.
The Wilson interval is preferred over the naïve Wald interval because it behaves well at the extremes (p = 0 or p = 1) and for small N.
Formula: (p̂ + z²/2n ± z√(p̂(1−p̂)/n + z²/4n²)) / (1 + z²/n)
where z = 1.96 for 95 % confidence.
Trait Implementations§
Source§impl Clone for ConfidenceInterval95
impl Clone for ConfidenceInterval95
Source§fn clone(&self) -> ConfidenceInterval95
fn clone(&self) -> ConfidenceInterval95
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfidenceInterval95
impl Debug for ConfidenceInterval95
Source§impl<'de> Deserialize<'de> for ConfidenceInterval95
impl<'de> Deserialize<'de> for ConfidenceInterval95
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ConfidenceInterval95
impl Serialize for ConfidenceInterval95
impl Copy for ConfidenceInterval95
Auto Trait Implementations§
impl Freeze for ConfidenceInterval95
impl RefUnwindSafe for ConfidenceInterval95
impl Send for ConfidenceInterval95
impl Sync for ConfidenceInterval95
impl Unpin for ConfidenceInterval95
impl UnsafeUnpin for ConfidenceInterval95
impl UnwindSafe for ConfidenceInterval95
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more