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

count and sample size for first sample

nobs1

count and sample size for first sample

count2

count and sample size for the second sample

nobs2

count and sample size for the second sample

value : float

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 : string in ['diff', 'ratio' 'odds-ratio']

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)

return_results : bool

If true, then a results instance with extra information is returned, otherwise a tuple with statistic and pvalue is returned.

Returns:

results – If return_results is True, then a results instance with the information in attributes is returned. If return_results is False, then only statistic and pvalue are returned.

statisticfloat

test statistic asymptotically normal distributed N(0, 1)

pvaluefloat

p-value based on normal distribution

other attributes :

additional information about the hypothesis test

Return type:

results instance or tuple

Notes

Status: experimental, the type or extra information in the return might change.