Announcement

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

  • #16
    Thinking about this thread during the last few days, perhaps -testnl- can also contribute to decide about the evidence of a -poisson- mechanism.
    Starting off from the first lines of Nick Cox 's code:
    Code:
    . set obs 1000
    number of observations (_N) was 0, now 1,000
    
    . set seed 2803
    
    . gen y = rpoisson(3)
    
    . sum y
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
               y |      1,000       3.029    1.746198          0         10
    
    . testnl (_se[y]^2*1000)/_b[y]=1
    
      (1)  (_se[y]^2*1000)/_b[y] = 1
    
                   chi2(1) =        0.13
               Prob > chi2 =        0.7162
    In this example, the outcome of -testnl- does not reject the null of equidispersion between variance and mean (ie, the main feature of a -poisson- distribution).
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #17
      Dear Nick,
      I was able to do the exercise with the help of your code. However, I am getting all the expected values of less than 5 for one variable.
      Click image for larger version

Name:	output.png
Views:	1
Size:	34.6 KB
ID:	1501263


      In this scenario, should I rely on the chi-square test statistic?
      If not, then what should I do in this case to test the fit?

      Comment


      • #18
        Dear Carlo,

        Thank you for this alternative solution in #16.
        Why do you multiply 1000(=N) with variance in (1)?
        Since the index of dispersion is variance divided by mean then why do we need to multiply by 1000 in the numerator?

        Comment


        • #19
          You have a sample size of 10. You won't get clearcut signals from a sample so small. In essence you don't have enough information to reject Poissonness.


          Here is what your analysis implies:

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float(x frequency)
           0 0
           1 0
           2 1
           3 1
           4 2
           5 2
           6 0
           7 3
           8 0
           9 0
          10 0
          11 0
          12 1
          end
          
          su x [w=freq]
          
          gen expected = 10 * poissonp(5.6, x)
          
          set obs 14 
          replace x = 13 in L
          label def x 13 "13 up"
          label val x x 
          
          su expected
          replace expected = 10 - r(sum) in L
          
          set scheme s1color
          twoway bar freq x, xla(0/13, valuelabel) barw(0.8) bfcolor(eltgreen*0.3) ///
          || connected exp x, ytitle(frequency) legend(order(2) pos(1) ring(0)) yla(, ang(h))
          Click image for larger version

Name:	poisson.png
Views:	1
Size:	25.2 KB
ID:	1501275


          However, back in #1 you said


          I have a variable - number of people who are malnourished in a PSU. I have approximately 2000 independently surveyed PSUs. Data would like as follows:
          X
          20
          30
          50
          70
          .
          .
          .
          .
          80
          so this analysis seems to bear absolutely no relation to your original question.

          Comment


          • #20
            Gaurav:
            Code:
            . . sum y
            
                Variable |        Obs        Mean    Std. Dev.       Min        Max
            -------------+---------------------------------------------------------
                       y |      1,000       3.029    1.746198          0         10
            
            .
            *Variance of y calculated from standard deviation*
            .
            . di r(sd)^2
            3.0492082
            
            . mean y
            
            Mean estimation                   Number of obs   =      1,000
            
            --------------------------------------------------------------
                         |       Mean   Std. Err.     [95% Conf. Interval]
            -------------+------------------------------------------------
                       y |      3.029   .0552196       2.92064     3.13736
            --------------------------------------------------------------
            
            *Variance of y calculated from standard error of the mean with N=1000*
            
            . di (.0552196^2*1000)
            3.0492042
            
            .
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #21
              Dear Nick,

              Thank you for further explanation.
              Yes, you are right. In the first case (#1) I was trying to fit the Poisson distribution for the PSUs at the national level which are approximately 2000 in number. However, in the last query (#17) I did it at the district level and hence the number of PSUs reduce to 10 in the latter case.

              Comment


              • #22
                Dear Carlo,

                Thank you for making it more clear.

                Comment


                • #23
                  A full analysis would surely feature population at risk too.

                  Comment

                  Working...
                  X