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
count and sample size for first sample
- count2, 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
str
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_resultsbool
If true, then a results instance with extra information is returned, otherwise a tuple with statistic and pvalue is returned.
- Returns:
- results
results
instance
ortuple
If return_results is True, then a results instance with the information in attributes is returned. If return_results is False, then only
statistic
andpvalue
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
- results
Notes
Status: experimental, the type or extra information in the return might change.