mqr.inference.power.

TestPower#

class mqr.inference.power.TestPower(name: str, alpha: float64, beta: float64, effect: float64, alternative: str, method: str, sample_size: int)#

Result of a sample size calculation for an hypothesis test.

Attributes:
namestr

Description of the hypothesis test.

alphafloat

Required significance level.

betafloat

Complement of the required power: 1 - power.

effectfloat

Required effect size of the test.

alternative{‘two-sided’, ‘less’, ‘greater’}

Sense of the test alternative.

methodstr

Name of the hypothesis test method, if applicable. For example, ‘t-test’.

sample_sizeint

Lower bound on the sample size to achieve the above parameters.

Examples

Calculations solving for power or sample size produce types like this.

>>> mqr.inference.power.TestPower(
>>>     name="PowerName",
>>>     alpha=0.01,
>>>     beta=0.10,
>>>     effect=1.5,
>>>     alternative="greater",
>>>     method="TestMethod",
>>>     sample_size=45)
TestPower(
    name='PowerName',
    alpha=0.05, beta=0.1, effect=1.5,
    alternative='greater', method='TestMethod',
    sample_size=45)

In jupyter notebooks, power calculations are rendered as an HTML table:

Test Power
PowerName

alpha

0.05

beta

0.1

effect

1.5

alternative

greater

method

TestMethod

sample size

45