[][src]Struct mathru::statistics::test::T

pub struct T<K> { /* fields omitted */ }

T-Test

Fore more information: https://en.wikipedia.org/wiki/Student%27s_t-test

Example

use mathru::{
    self,
    statistics::{
        distrib::{Distribution, Normal},
        test::{Test, T},
    },
};

let rv1 = Normal::new(1.0, 0.5).random_sequence(100);
let rv2 = Normal::new(1.0, 0.5).random_sequence(100);

//Test with sample with identical means
let mut measure: T<f64> = T::test_independence_unequal_variance(&rv1, &rv2);
println!("{}", measure.value());
measure = T::test_independence_equal_variance(&rv1, &rv2);
println!("{}", measure.value());

// Test with different equal mean, but unequal variances
let rv3 = Normal::new(1.0, 1.5).random_sequence(100);
measure = T::test_independence_unequal_variance(&rv1, &rv3);
println!("{}", measure.value());
measure = T::test_independence_equal_variance(&rv1, &rv3);
println!("{}", measure.value());

// When the sample size is not equal anymore
//the equal variance t-statistic is no longer equal to the unequal variance t-statistic:
let rv4 = Normal::new(2.0, 0.5).random_sequence(300);
measure = T::test_independence_unequal_variance(&rv1, &rv4);
println!("{}", measure.value());
measure = T::test_independence_equal_variance(&rv1, &rv4);
println!("{}", measure.value());

//t-Test with different mean, variance and sample size
let rv5 = Normal::new(2.0, 1.0).random_sequence(300);
measure = T::test_independence_unequal_variance(&rv1, &rv5);
println!("{}", measure.value());
measure = T::test_independence_equal_variance(&rv1, &rv5);
println!("{}", measure.value());

Implementations

impl<K> T<K> where
    K: Real + Gamma + Beta + Error + Hypergeometric
[src]

pub fn one_sample(x: &Vec<K>, mu_0: K) -> T<K>[src]

This is a one-sided test for the null hypothesis that the expected value (mean) of a sample of independent observations a is equal to the given mean.

x: observation

pub fn test_independence_equal_variance(x: &Vec<K>, y: &Vec<K>) -> T<K>[src]

Calculates the T-test for the means of two independent samples of scores

This is a two-sided test for the null hypothesis that two independent samples have identical expected values. It is assumed, that the populations have identical variances.

pub fn test_independence_unequal_variance(x: &Vec<K>, y: &Vec<K>) -> T<K>[src]

Calculates the T-test for the means of two independent samples of scores

This is a two-sided test for the null hypothesis that two independent samples have identical expected values. It is assumed, that the populations have NOT identical variances. It performs the Welch’s t-test

Trait Implementations

impl<K: Clone> Clone for T<K>[src]

impl<K: Copy> Copy for T<K>[src]

impl<K: Debug> Debug for T<K>[src]

impl<'de, K> Deserialize<'de> for T<K> where
    K: Deserialize<'de>, 
[src]

impl<K> Serialize for T<K> where
    K: Serialize
[src]

impl<K> Test<K> for T<K> where
    K: Real
[src]

pub fn value(&self) -> K[src]

Test value

pub fn df(&self) -> u32[src]

Degree of freedom

pub fn p_value(&self) -> K[src]

Auto Trait Implementations

impl<K> RefUnwindSafe for T<K> where
    K: RefUnwindSafe

impl<K> Send for T<K> where
    K: Send

impl<K> Sync for T<K> where
    K: Sync

impl<K> Unpin for T<K> where
    K: Unpin

impl<K> UnwindSafe for T<K> where
    K: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,