Skip to content

ENH: simultaneous confidence intervals for multinomial proportions #2895

Closed

Description

@wehlutyk

I've been looking around for a pythonic way of computing this, and have found nothing.

The MultinomialCI R package implements the method from Sison & Glaz (1995), Simultaneous confidence intervals and sample size determination for multinomial proportions, which seems to be the reference (for asymptotic confidence intervals) in the literature.

Would a port of this package in statsmodels.stats.proportion.multinomial_proportion_confint() interest the statsmodels team?

Activity

  1. josef-pkt commented on Apr 17, 2016

    @josef-pkt
    Member

    A direct port will not be useful to us because of the licence incompatibility.

    Based on a brief look at the Sison and Glaz article it might not be too difficult to implement it from scratch.

    I have never looked at simultaneous confidence intervals in this area, so right now I don't have any background information for this. It sounds interesting and like a good addition.

  2. wehlutyk commented on Apr 17, 2016

    @wehlutyk
    ContributorAuthor

    All right. I'll try and do an original implementation based on Sison & Glaz then.

  3. wehlutyk commented on May 4, 2016

    @wehlutyk
    ContributorAuthor

    The R package linked to above is in fact "an R translation of the SAS code implemented by May and Johnson in their paper: May, W.L. and W.D. Johnson. Constructing two-sided simultaneous confidence intervals for multinomial proportions for small counts in a large number of cells". May & Johnson (1997) also implements other methods (for e.g. lower number of cells) for multinomial CIs.

    I can't find any licensing information on those two papers, but it seems to me rather standard to adapt code from published papers as long as they're cited. Would that be okay license-wise?

  4. josef-pkt commented on May 4, 2016

    @josef-pkt
    Member

    papers and published articles are still copyrighted. (usual disclaimer: I'm not a lawyer.)
    When I started with scipy around 8 years ago, the answer was negative. Without a compatible license statement or explicit permission by the authors it is not allowed to translate the code and redistribute it under a different license. Some journals that publish more software have a, most of the time restrictive, default copyright statement.

    I'm personally not completely restrictive anymore and sometimes check part of the code that is in an article when something is not clear from the main text of the article.


    I went over some of the papers after this issue was opened.
    May and Johson 1997 looks relatively straightforward. In section for they list the earlier confidence intervals which are base mostly on roots of quadratic functions.

    Sison and Glaz have a few tricky part, but the description in the later May Johnson sounded ok, and explained where they deviated in the implementation from the original Sison/Glaz paper. (I don't see that I have a printed copy, so I guess I only skimmed and read parts of the second May Johnson paper in pdf.)

    I also found a few recent articles that describe fast exact algorithms for multinomial box probabilities, but they looked a lot more computation and more for someone that is interested in implementing numerical algorithms (like scipy special).

    If you want to get started with this, I think it would be best to start with the quadratic equations in May Johnson 1997 and some test cases. I can look into Sison/Glaz and the second May/Johnson again. (My guess would be that searching for c in Sison/Glaz might be faster when starting with something like Quesenberry and Hurst intervals (approximately because the shape of the confidence region is different)).

  5. josef-pkt commented on May 18, 2016

    @josef-pkt
    Member

    I'm adding a comment here instead of pull request #2953 that mentioned the reference

    I read through Hou, Chiang, & Tai (2003):
    I don't think it's a likely candidate to implement, it's a bit strange, sounds expensive, and they don't state whether their capital lambda interval is always nonempty (i.e. for -1 <= lambda <=2). And the article doesn't have many citations.

    The "strange" part is that choosing the test statistic (lambda) and with it the shape of the confidence region (AFAIU) to match the small sample size (rejection rate under the null) seems to me to mix two things that shouldn't be related. In general we choose a test statistic and then check or correct the size of the hypothesis test. (Even though in practice, not in theory, we still choose tests by their properties.)

    Also they nest a newton-raphson root search inside a Monte Carlo inside a grid search. I didn't quite understand all the details, but it doesn't sound cheap.

    On the other hand, searching in Google Scholar doesn't find much in this area, and citation counts are low in general, AFAICS. binomial proportion and poisson rates have a lot more recent surveys for tests and confidence intervals.

  6. josef-pkt commented on May 18, 2016

    @josef-pkt
    Member

    A bit different setting but it explains simultaneous bootstrap confidence intervals with multinomial sampling (e.g. bootstrap-t confint):
    Tang, Nian-Sheng, Shi-Fang Qiu, Man-Lai Tang, Guang-Yong Zou, and Dan Yu. "Simultaneous Confidence Intervals of Risk Differences in Stratified Paired Designs." Journal of biopharmaceutical statistics 23, no. 2 (2013): 361-377.

    and here is an interesting note, that we run into similar problem as Wald test with boundary observations n_i = 0 or n_i = 1 also with bootstrap and Monte Carlo if probabilities are based on prob=0 or 1 (we don't simulate variation in the sample)
    Wang, Weizhen. "A note on bootstrap confidence intervals for proportions." Statistics & Probability Letters 83, no. 12 (2013): 2699-2702.

    Not many citations in this neighborhood either, but at least it sounds standard.

  7. wehlutyk commented on May 18, 2016

    @wehlutyk
    ContributorAuthor

    Wow, I'd need to do a lot more reading to get through this correctly (and the comments in #2953)! I'm going to follow the discussion on MC methods from afar for now, and will chip in (ev. with implementations) if I get more free time in the future, but right now it's a bit of a big bite. I haven't read Tang et al., but what you say about Hou et al. sounds right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions