mqr.inference.rate.
size_2sample#
- mqr.inference.rate.size_2sample(r1, r2, alpha, beta, H0_value=None, alternative='two-sided', method='score', compare='diff')#
Calculate sample size for difference of two rates of events.
- Null-hypothesis by compare
- ‘diff’r1 - r2 == H0_value‘ratio’r1 / r2 == H0_value
- Parameters:
- r1float
First rate.
- r2float
Second rate.
- alphafloat
Required significance.
- betafloat
Required beta (1 - power).
- H0_valuefloat, optional
Null-hypothesis rate. Default 0 for ‘diff’, 1 for ‘ratio’.
- alternative{‘two-sided’, ‘less’, ‘greater’}, optional
Sense of alternative hypothesis.
- methodstr, optional
- ‘z’Approximation based a normal approximation. For this method, compare must be ‘diff’ and H0_value must be 0.(other)All other methods are passed as parameters to
power_2sample
while that function is solved numerically equal to the requested power by varying nobs. - compare{‘diff’, ‘ratio’}, optional
- ‘diff’Compare the difference between rates.‘ratio’Compare the ratio of rates.
- Returns: