lib/statistics/statistical_test/t_test.rb in ruby-statistics-2.0.2 vs lib/statistics/statistical_test/t_test.rb in ruby-statistics-2.0.3

- old
+ new

@@ -34,18 +34,19 @@ left_root = sample_left_variance/args[0].size.to_f right_root = sample_right_variance/args[1].size.to_f standard_error = Math.sqrt(left_root + right_root) - (sample_left_mean - sample_right_mean)/standard_error.to_f + (sample_left_mean - sample_right_mean).abs/standard_error.to_f end probability = Distribution::TStudent.new(degrees_of_freedom).cumulative_function(t_score) p_value = 1 - probability p_value *= 2 if tails == :two_tail - { probability: probability, + { t_score: t_score, + probability: probability, p_value: p_value, alpha: alpha, null: alpha < p_value, alternative: p_value <= alpha, confidence_level: 1 - alpha } @@ -69,10 +70,11 @@ probability = Distribution::TStudent.new(degrees_of_freedom).cumulative_function(t_score) p_value = 1 - probability p_value *= 2 if tails == :two_tail - { probability: probability, + { t_score: t_score, + probability: probability, p_value: p_value, alpha: alpha, null: alpha < p_value, alternative: p_value <= alpha, confidence_level: 1 - alpha }