Fwd: Binomial proportion confidence interval

Hi, I would like to add approximate intervals [1] to the scipy project. Approximate intervals often have higher statistical power than exact intervals for binomial random variables. Example usage can be found in the "binom R" package [2]. In analogy to [3], I see two possible ways to integrate these methods into the scipy API: (a,b) = scipy.stats.binom.approx_interval(alpha, loc, scale, method='wilson') (a,b) = scipy.stats.binom.wilson_interval(alpha, loc, scale), where (a,b) are the end-points of range that contain 100*alpha % of the rv's possible values. What do you think? Best, Christoph [1] http://www-stat.wharton.upenn.edu/~tcai/paper/Binomial-StatSci.pdf [2] http://cran.r-project.org/web/packages/binom/index.html [3] http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete....

On Wed, Apr 16, 2014 at 8:16 AM, Christoph Sawade <christoph.sawade@googlemail.com> wrote:
Hi,
I would like to add approximate intervals [1] to the scipy project. Approximate intervals often have higher statistical power than exact intervals for binomial random variables. Example usage can be found in the "binom R" package [2]. In analogy to [3], I see two possible ways to integrate these methods into the scipy API:
(a,b) = scipy.stats.binom.approx_interval(alpha, loc, scale, method='wilson') (a,b) = scipy.stats.binom.wilson_interval(alpha, loc, scale),
where (a,b) are the end-points of range that contain 100*alpha % of the rv's possible values.
What do you think?
I added them to statsmodels http://statsmodels.sourceforge.net/devel/generated/statsmodels.stats.proport... together with other functions supporting proportions http://statsmodels.sourceforge.net/devel/stats.html#proportion Josef
Best, Christoph
[1] http://www-stat.wharton.upenn.edu/~tcai/paper/Binomial-StatSci.pdf [2] http://cran.r-project.org/web/packages/binom/index.html [3] http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete....
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev

On 16 Apr 2014, at 14:22, josef.pktd@gmail.com wrote:
On Wed, Apr 16, 2014 at 8:16 AM, Christoph Sawade <christoph.sawade@googlemail.com> wrote:
Hi,
I would like to add approximate intervals [1] to the scipy project. Approximate intervals often have higher statistical power than exact intervals for binomial random variables. Example usage can be found in the "binom R" package [2]. In analogy to [3], I see two possible ways to integrate these methods into the scipy API:
(a,b) = scipy.stats.binom.approx_interval(alpha, loc, scale, method='wilson') (a,b) = scipy.stats.binom.wilson_interval(alpha, loc, scale),
where (a,b) are the end-points of range that contain 100*alpha % of the rv's possible values.
What do you think?
I added them to statsmodels http://statsmodels.sourceforge.net/devel/generated/statsmodels.stats.proport... together with other functions supporting proportions
http://statsmodels.sourceforge.net/devel/stats.html#proportion
Josef
I didn’t look in detail, but FYI there’s also these binomial stats methods in Astropy: http://docs.astropy.org/en/latest/api/astropy.stats.binned_binom_proportion.... http://docs.astropy.org/en/latest/api/astropy.stats.binom_conf_interval.html Seems some people use those a lot, i.e. `scipy.stats` would be an appropriate place? Christoph
Best, Christoph
[1] http://www-stat.wharton.upenn.edu/~tcai/paper/Binomial-StatSci.pdf [2] http://cran.r-project.org/web/packages/binom/index.html [3] http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete....
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev

On Wed, Apr 16, 2014 at 2:25 PM, Christoph Deil < deil.christoph@googlemail.com> wrote:
On 16 Apr 2014, at 14:22, josef.pktd@gmail.com wrote:
On Wed, Apr 16, 2014 at 8:16 AM, Christoph Sawade <christoph.sawade@googlemail.com> wrote:
Hi,
I would like to add approximate intervals [1] to the scipy project. Approximate intervals often have higher statistical power than exact intervals for binomial random variables. Example usage can be found in the "binom R" package [2]. In analogy to [3], I see two possible ways to integrate these methods into the scipy API:
(a,b) = scipy.stats.binom.approx_interval(alpha, loc, scale, method='wilson') (a,b) = scipy.stats.binom.wilson_interval(alpha, loc, scale),
where (a,b) are the end-points of range that contain 100*alpha % of the rv's possible values.
What do you think?
I added them to statsmodels
http://statsmodels.sourceforge.net/devel/generated/statsmodels.stats.proport... together with other functions supporting proportions
http://statsmodels.sourceforge.net/devel/stats.html#proportion
Josef
I didn’t look in detail, but FYI there’s also these binomial stats methods in Astropy:
http://docs.astropy.org/en/latest/api/astropy.stats.binned_binom_proportion....
http://docs.astropy.org/en/latest/api/astropy.stats.binom_conf_interval.html
Seems some people use those a lot, i.e. `scipy.stats` would be an appropriate place?
It doesn't seem to me like this is used often enough that it *has to be* in scipy, but it could be. If the statsmodels and astropy devs agree that this makes sense, maybe their functions can be merged into something that works for both projects and then contributed to scipy.stats? Ralf
Christoph
Best, Christoph
[1] http://www-stat.wharton.upenn.edu/~tcai/paper/Binomial-StatSci.pdf [2] http://cran.r-project.org/web/packages/binom/index.html [3]
http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.rv_discrete....
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-dev
participants (4)
-
Christoph Deil
-
Christoph Sawade
-
josef.pktd@gmail.com
-
Ralf Gommers