votingworks / arlo

GNU Affero General Public License v3.0
141 stars 25 forks source link

get_sample_size for one candidate - what to return? #872

Open nealmcb opened 3 years ago

nealmcb commented 3 years ago

What should get_sample_size return for a single candidate contest?

A test case in https://github.com/votingworks/arlo/pull/868/ currently says:

d5 = minerva.make_arlo_contest({"a": 300})
    res = minerva.get_sample_size(10, d5, None, [])
    assert res == {
        "0.7": {"type": None, "size": -1, "prob": 0.7},
        "0.8": {"type": None, "size": -1, "prob": 0.8},
        "0.9": {"type": None, "size": -1, "prob": 0.9},
    }

This is based on the way that BRAVO currently handles it, but I think a good argument can be made to return 1 instead, perhaps in a single response as the ASN. I don't know of any way that the current Arlo version could call get_sample_size with one candidate, but that may well change, and the various methods should handle it in a consistent way.

nealmcb commented 3 years ago

"Landslide" elections with a margin of 100.0% are related.

The BRAVO approach of returning 1 for this seems wrong, since you'd need to return at least 4 for e.g. a 10% risk limit.