Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • test for comparing two Poisson means

    Hi. I work with count data and the comparison of the two groups is the purpose of my study. My professor has suggested using the poisson test instead of t- test. How can I get this test in Stata?

  • #2
    Parastou:
    you may want to try something along the following lines:
    Code:
    poisson <count_depvar> i.group
    Beware of -poisson- extradispersion (that usually means overdispersion).
    See -help estat gof-, -poisson-, -poisson postestimation- and -nbreg- entries in Stata .pdf manual.
    Kind regards,
    Carlo
    (Stata 15.1 SE)

    Comment


    • #3
      Your professor gave you good advice, for count data dovetails with Poisson (and other count-data) models.

      You may start by typing - help poisson - in the Command Window, then take a look at the examples.

      P.S.: Crossed with Carlo's excellent advice.
      Best regards,

      Marcos

      Comment


      • #4
        Marcos' helpful reply reminds me that I forgot to mention two really valuable textbooks on count data analysis (with many Stata examples), both written by the deeply missed Joe Hilbe:

        https://www.stata.com/bookstore/modeling-count-data/

        https://www.stata.com/bookstore/nega...al-regression/
        Kind regards,
        Carlo
        (Stata 15.1 SE)

        Comment


        • #5
          Thank you everyone for your responses. I have count data for two case and control groups that I think using the poisson test that compare the means of the two groups can be appropriate and poisson regression is not an appropriate option for this. I read an article that I think is similar to my work and attach it. I also used the stata help, but I could not find the sightly test.

          Comment


          • #6
            It seems to me that Marcos Almeida and Carlo Lazzaro are on target here. In #1 you referred to two groups. If you are saying that your set-up is more complicated than that the answer is still some kind of model with group indicators as predictors. Comparing means **is** regression!

            Comment


            • #7
              In a previous thread, some of us discussed how ANOVA is a special case of linear regression. In that sense, Poisson regression can't be an inappropriate option. It would be equally valid as the ANOVA equivalent of Poisson, assuming one exists. This is just another way to re-state Nick's assertion that regression and comparing means are equivalent.

              I am not well-versed in ANOVA-like analyses, because my field has really defaulted to linear regression and derivatives of that. However, I'm not aware of a Poisson test that is equivalent to ANOVA or a t-test. So, that's the other issue - there may be no such test.

              I also can't see any attachments to post #5, and the link just goes to computing services at the University of Louisiana, Lafayette.
              Please use the code delimiters to show code and results - use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

              Please use the command -dataex- to show a representative sample of data; it is installed already if you have Stata 14.2 or 15.1, else you can install it by typing

              Code:
              ssc install dataex

              Comment


              • #8
                Historically, counted responses were often (square) rooted before being fed to ANOVA. That seems a long way round now.

                Comment


                • #9
                  If by "Poisson test" you're thinking about something like "poisson.test" in R, perhaps you may take a look at the functions poisson(m,k), poissontail(m,k) and poissonp(m,k) as well.
                  Best regards,

                  Marcos

                  Comment


                  • #10
                    Parastou:
                    I do agree with all Statalister's reply on this query.
                    Besides, sneaking out the -poisson- regression framework in favour of the Poisson test (admittedly, a tool I'm not familiar with) does not shelter you from having data that (as it is dramatically often the case with empirical research) do not behave as they were Poisson distributed (Poisson distribution is often a brave assumption; see : https://stats.stackexchange.com/ques...d-poisson-test).
                    Hence, even though you state (or your supervisor states) that
                    poisson regression is not an appropriate option for this...
                    , you may end up with a test that is biased, just like coefficients obtained from a misspecified Poisson regression are.
                    However, with -poisson postestimation- (-estat gof-; -linktest-) you can investigate whether or not you're on target with -poisson-: I do not know whether you can do the same with the Poisson test.
                    Kind regards,
                    Carlo
                    (Stata 15.1 SE)

                    Comment


                    • #11
                      Here is my data.
                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input byte unit long y1
                      1 160922
                      1  57651
                      1 187935
                      1  13388
                      1 126092
                      1  57127
                      1  65543
                      1 158292
                      1  54349
                      1 185688
                      1  12209
                      1 131718
                      1  55670
                      1  63299
                      2 163611
                      2  62008
                      2 188211
                      2  18002
                      2 133423
                      2  62538
                      2  71836
                      2 164593
                      2  59152
                      2 189614
                      2  18898
                      2 129850
                      2  63540
                      2  72927
                      end
                      I am just looking for the proper poisson test to compare the variable in these two groups.
                      Last edited by parastou amirifar; 12 Feb 2019, 09:06.

                      Comment


                      • #12
                        Adapt the code in #2. But, but, but: there is other structure here you are not telling us about.

                        Click image for larger version

Name:	poisson.png
Views:	1
Size:	19.4 KB
ID:	1483285
                        Last edited by Nick Cox; 12 Feb 2019, 09:22.

                        Comment


                        • #13
                          Parastou:
                          your data do not follow a Poisson distribution. You would be better off with -nbreg-:
                          Code:
                          . poisson y1 i.unit
                          
                          Iteration 0:   log likelihood = -527164.51 
                          Iteration 1:   log likelihood = -527164.51 
                          
                          Poisson regression                              Number of obs     =         28
                                                                          LR chi2(1)        =    1711.13
                                                                          Prob > chi2       =     0.0000
                          Log likelihood = -527164.51                     Pseudo R2         =     0.0016
                          
                          ------------------------------------------------------------------------------
                                    y1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                2.unit |   .0500969   .0012113    41.36   0.000     .0477228    .0524709
                                 _cons |   11.46154   .0008671  1.3e+04   0.000     11.45984    11.46324
                          ------------------------------------------------------------------------------
                          
                          . estat gof
                          
                                   Deviance goodness-of-fit =   1053963
                                   Prob > chi2(26)          =    0.0000
                          
                                   Pearson goodness-of-fit  =    982949
                                   Prob > chi2(26)          =    0.0000
                          
                          . nbreg y1 i.unit
                          
                          Fitting Poisson model:
                          
                          Iteration 0:   log likelihood = -527164.51 
                          Iteration 1:   log likelihood = -527164.51 
                          
                          Fitting constant-only model:
                          
                          Iteration 0:   log likelihood = -349.63352 
                          Iteration 1:   log likelihood =  -346.3941 
                          Iteration 2:   log likelihood = -345.79765 
                          Iteration 3:   log likelihood = -345.79765 
                          
                          Fitting full model:
                          
                          Iteration 0:   log likelihood =  -345.7788 
                          Iteration 1:   log likelihood = -345.77879 
                          
                          Negative binomial regression                    Number of obs     =         28
                                                                          LR chi2(1)        =       0.04
                          Dispersion     = mean                           Prob > chi2       =     0.8460
                          Log likelihood = -345.77879                     Pseudo R2         =     0.0001
                          
                          ------------------------------------------------------------------------------
                                    y1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                2.unit |   .0500969   .2578459     0.19   0.846    -.4552717    .5554655
                                 _cons |   11.46154   .1823246    62.86   0.000     11.10419    11.81889
                          -------------+----------------------------------------------------------------
                              /lnalpha |   -.764898    .249315                     -1.253546   -.2762496
                          -------------+----------------------------------------------------------------
                                 alpha |   .4653814   .1160266                      .2854905    .7586235
                          ------------------------------------------------------------------------------
                          LR test of alpha=0: chibar2(01) = 1.1e+06              Prob >= chibar2 = 0.000
                          
                          .
                          Kind regards,
                          Carlo
                          (Stata 15.1 SE)

                          Comment

                          Working...
                          X