statsmodels.stats.proportion.score_test_proportions_2indep#
- statsmodels.stats.proportion.score_test_proportions_2indep(count1, nobs1, count2, nobs2, value=None, compare='diff', alternative='two-sided', correction=True, return_results=True)[source]#
Score test for two independent proportions
This uses the constrained estimate of the proportions to compute the variance under the Null hypothesis.
- Parameters:
- count1, nobs1
int count and sample size for first sample
- count2, nobs2
int count and sample size for the second sample
- value
float,optional diff, ratio or odds-ratio under the null hypothesis. If value is None, then equality of proportions under the Null is assumed, i.e., value=0 for ‘diff’ or value=1 for either rate or odds-ratio.
- compare
strin[‘diff’, ‘ratio’, ‘odds-ratio’],optional If compare is diff, then the confidence interval is for diff = p1 - p2. If compare is ratio, then the confidence interval is for the risk ratio defined by ratio = p1 / p2. If compare is odds-ratio, then the confidence interval is for the odds-ratio defined by or = p1 / (1 - p1) / (p2 / (1 - p2)
- alternative{‘two-sided’, ‘smaller’, ‘larger’},
optional alternative hypothesis, which can be two-sided or either one of the one-sided tests.
- correctionbool,
optional If correction is True (default), then the Miettinen and Nurminen small sample correction to the variance nobs / (nobs - 1) is used.
- return_resultsbool,
optional If true, then a results instance with extra information is returned, otherwise a tuple with statistic and pvalue is returned.
- count1, nobs1
- Returns:
ScoreTestProportionsResultortupleIf return_results is True (default), then a
ScoreTestProportionsResultresult object is returned. If return_results is False, then only a plain(statistic, pvalue)tuple is returned.
Notes
Status: experimental, the type or extra information in the return might change.