Equal variance t-test
Regular test¶
#
HypothesisTests.EqualVarianceTTest
— Type.
1 2 | EqualVarianceTTest(d1::AbstractUncertainValue, d2::AbstractUncertainValue, n::Int = 1000; μ0::Real = 0) -> EqualVarianceTTest |
Consider two samples s1
and s2
, each consisting of n
random draws from the distributions furnishing d1
and d2
, respectively.
This function performs a two-sample t-test of the null hypothesis that s1
and s2
come from distributions with equal means and variances against the alternative hypothesis that the distributions have different means but equal variances.
Example
Let's create two uncertain values furnished by distributions of different types. We'll perform the equal variance t-test to check if there is support for the null-hypothesis that the distributions furnishing the uncertain values come from distributions with equal means and variances.
We expect the test to reject this null-hypothesis, because we've created two very different distributions.
1 2 3 4 5 | uv1 = UncertainValue(Normal, 1.2, 0.3) uv2 = UncertainValue(Gamma, 2, 3) # EqualVarianceTTest on 1000 draws for each variable EqualVarianceTTest(uv1, uv2, 1000) |
The output is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Two sample t-test (equal variance) ---------------------------------- Population details: parameter of interest: Mean difference value under h_0: 0 point estimate: -4.782470406651697 95% confidence interval: (-5.0428, -4.5222) Test summary: outcome with 95% confidence: reject h_0 two-sided p-value: <1e-99 Details: number of observations: [1000,1000] t-statistic: -36.03293014520585 degrees of freedom: 1998 empirical standard error: 0.1327249931487462 |
The test rejects the null-hypothesis, so we accept the alternative hypothesis that the samples come from distributions with different means and variances.
Pooled test¶
#
UncertainData.UncertainStatistics.EqualVarianceTTestPooled
— Function.
1 2 | EqualVarianceTTestPooled(d1::UncertainDataset, d2::UncertainDataset, n::Int = 1000; μ0::Real = 0) -> EqualVarianceTTest |
Consider two samples s1[i]
and s2[i]
, each consisting of n
random draws from the distributions furnishing the uncertain values d1[i]
and d2[i]
, respectively. Gather all s1[i]
in a pooled sample S1
, and all s2[i]
in a pooled sample S2
.
Perform a two-sample t-test of the null hypothesis that S1
and S2
come from distributions with equal means and variances against the alternative hypothesis that the distributions have different means but equal variances.
Element-wise test¶
#
UncertainData.UncertainStatistics.EqualVarianceTTestElementWise
— Function.
1 2 | EqualVarianceTTestElementWise(d1::UncertainDataset, d2::UncertainDataset, n::Int = 1000; μ0::Real = 0) -> Vector{EqualVarianceTTest} |
Consider two samples s1[i]
and s2[i]
, each consisting of n
random draws from the distributions furnishing the uncertain values d1[i]
and d2[i]
, respectively. This function performs an elementwise EqualVarianceTTest
on the pairs (s1[i], s2[i])
. Specifically:
Performs an pairwise two-sample t-test of the null hypothesis that s1[i]
and s2[i]
come from distributions with equal means and variances against the alternative hypothesis that the distributions have different means but equal variances.