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

pub struct T { /* fields omitted */ }

T-Test

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

Example

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

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

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

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

// 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_vector(300);
measure = T::test_independence_unequal_variance(&rv1, &rv4);
println!("{}", measure.t());
measure = T::test_independence_equal_variance(&rv1, &rv4);
println!("{}", measure.t());

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

Methods

impl T[src]

pub fn t(&self) -> f64[src]

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

pub fn test_independence_equal_variance(x: &Vector<f64>, y: &Vector<f64>) -> T[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: &Vector<f64>, y: &Vector<f64>) -> T[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

Auto Trait Implementations

impl Send for T

impl Sync for T

impl Unpin for T

impl UnwindSafe for T

impl RefUnwindSafe for T

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

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