![]() |
|
Navigation |
Synopsis T-test on sample data.
Function
Usage
import analysis::statistics::Inference;
Description Perform student's t-test
![]()
Examples We use the data from the following example
![]() rascal>import util::Math; ok rascal>import analysis::statistics::Descriptive; ok rascal>import List; ok rascal>s1 = [5,7,5,3,5,3,3,9]; list[int]: [5,7,5,3,5,3,3,9] rascal>s2 = [8,1,4,6,6,4,1,2]; list[int]: [8,1,4,6,6,4,1,2] rascal>(mean(s1) - mean(s2))/sqrt(variance(s1)/size(s1) + variance(s2)/size(s2)); real: 0.847318545739313442237695301445819365361600242897486018389686This is the same result as obtained in the cited example. We can also compute it directly using the tTest functions:
rascal>import analysis::statistics::Inference; ok rascal>tTest(s1, s2); num: 0.4115203997374087Observe that this is a smaller value than comes out directly of the formula. Recall that: The number returned is the smallest significance level at which one can reject the null hypothesis that the two means are equal in favor of the two-sided alternative that they are different. Finally, we perform the test around the significance level we just obtained: rascal>tTest(s1,s2,0.40); bool: false rascal>tTest(s1,s2,0.50); bool: true ![]() |