Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-338

Pooled Standard Deviation Two Groups

Problem

The pooled standard deviation is sqrt(((n1 - 1) s1^2 + (n2 - 1) s2^2) / (n1 + n2 - 2)).

Given the two sample sizes and sample standard deviations, return the pooled standard deviation.

Hint

Weight each variance by its degrees of freedom.

Test cases

case 1
in: [10,2,15,3]
expected: 2.6539552107881486
case 2
in: [5,1,5,1]
expected: 1
case 3
in: [20,4,10,2]
expected: 3.484660262185848
Starter codePython
def pooled_standard_deviation_two_groups(n1, s1, n2, s2):
    # Your code here
    pass

3 test cases · run your code against them in the editor