Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-294

Cluster Design Effect (Unequal Sizes)

Problem

Return the design effect for a cluster-randomized trial with unequal cluster sizes: 1 + ((1 + cv^2)*mean_size - 1)*icc, where cv is the coefficient of variation of the cluster sizes. Return 0.0 for an empty list or negative icc.

Hint

Unequal cluster sizes inflate the Kish design effect.

Test cases

case 1
in: [[10,10,10,10],0.05]
expected: 1.45
case 2
in: [[5,15],0.1]
expected: 2.1500000000000004
case 3
in: [[],0.1]
expected: 0
case 4
in: [[10],0.2]
expected: 2.8
case 5
in: [[2,2],0]
expected: 1
Starter codePython
def cluster_design_effect(cluster_sizes, icc):
    # Your code here
    pass

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