snowshu.samplings.sample_sizes package¶
Submodules¶
snowshu.samplings.sample_sizes.brute_force_sample_size module¶
-
class
snowshu.samplings.sample_sizes.brute_force_sample_size.
BruteForceSampleSize
(percentage: float)¶ Bases:
snowshu.core.samplings.bases.base_sample_size.BaseSampleSize
Implements a static percentage sample size.
- Parameters
percentage – The decimal representation of the desired sample size between 1 and 99% (0.01 to 0.99).
-
property
percentage
¶
-
size
(population: int) → int¶ Calculates the sample size for a given population size.
- Parameters
population – The count of records in the full population.
- Returns
The minimum whole number of elements for a sample size given the instance margin of error and confidence.
snowshu.samplings.sample_sizes.cochrans_sample_size module¶
-
class
snowshu.samplings.sample_sizes.cochrans_sample_size.
CochransSampleSize
(margin_of_error: float, confidence: float)¶ Bases:
snowshu.core.samplings.bases.base_sample_size.BaseSampleSize
Implements Cochran’s theorum for large population sampling.
More information about Cochran’s theorum available here https://en.wikipedia.org/wiki/Cochran%27s_theorem.
- Parameters
margin_of_error – The decimal allowed error value between 1 and 10% (0.01 to 0.1).
confidence – The decimal representation of the desired confidence between 1 and 99% (0.01 to 0.99).
-
property
confidence
¶
-
property
margin_of_error
¶
-
size
(population: int) → int¶ Calculates the sample size for a given population size.
Uses Cochran’s theorum to return minimum viable sample size (rounded up to the nearest integer).
- Parameters
population – The count of records in the full population.
- Returns
The minimum whole number of elements for a sample size given the instance margin of error and confidence.