All problems
Pooled t Statistic Two Samples
Problem
The pooled two-sample t statistic uses the pooled variance sp^2 = ((n1 - 1) s1^2 + (n2 - 1) s2^2) / (n1 + n2 - 2) and computes t = (x1 - x2) / (sp * sqrt(1/n1 + 1/n2)).
Given the means, standard deviations, and sizes, return t.
Hint
Pool the variances first, then standardize by the combined standard error.
Test cases
case 1
in: [5,4,1,10,1,10]
expected: 2.23606797749979
case 2
in: [1,0,2,8,3,8]
expected: 0.7844645405527362
case 3
in: [2,2,1.5,6,1.5,6]
expected: 0
Starter codePython
def pooled_t_statistic_two_samples(x1, x2, s1, n1, s2, n2):
# Your code here
pass3 test cases · run your code against them in the editor