Re: st: Function for calculating a two-tailed probability statistic for a poisson distribution

 From "Svend Juul" To Subject Re: st: Function for calculating a two-tailed probability statistic for a poisson distribution Date Tue, 25 Oct 2005 23:12:43 +0200

```Dave wrote:

I am undertaking some survival analysis and want to derive a two-tailed
p-value for each record in the data.  Example data:

Sex             Age group   Observed  Expected  .. Poisson(two-tailed)
MALE           0-4 years         4      0.05    ..      ?
MALE           5-9 year         10      0.025   ..      ?
..
..
FEMALE         0-4               3      0.03    ....    ?
FEMALE         5-9              12      0.025   ....    ?

I know the algebra and can do this in Fortran but in Stata?  I need it
for each record and the overall data.

Can anyone please suggest a solution, perhaps a program, that I can
enter Observed and Expected as parameters and derive a two-tailed
p-value for each record?
------------------------------------------------------------

You may use -ci- with the -poisson- option. Using your example from above (with very small expected numbers):

clear
input sex age obs exp
1 0 4 0.05
1 5 10 0.025
2 0 4 0.03
2 5 12 0.025
end
sort sex age
by sex age: ci obs , poisson exposure(exp)

---------------------------------------------------------------------------------------------------
-> sex = 1, age = 0
-- Poisson  Exact --
Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
-------------+---------------------------------------------------------------
obs |        .05          80          40        21.79731    204.8318
---------------------------------------------------------------------------------------------------
-> sex = 1, age = 5
-- Poisson  Exact --
Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
-------------+---------------------------------------------------------------
obs |       .025         400    126.4911        191.8155    735.6142
---------------------------------------------------------------------------------------------------
-> sex = 2, age = 0
-- Poisson  Exact --
Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
-------------+---------------------------------------------------------------
obs |        .03    133.3333    66.66667        36.32885    341.3863
---------------------------------------------------------------------------------------------------
-> sex = 2, age = 5
-- Poisson  Exact --
Variable |   Exposure        Mean    Std. Err.       [95% Conf. Interval]
-------------+---------------------------------------------------------------
obs |       .025         480    138.5641         248.023    838.4634

Hope this helps
Svend

________________________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C,  Denmark
Phone, work:  +45 8942 6090
Phone, home:  +45 8693 7796
Fax:          +45 8613 1580
E-mail:       sj@soci.au.dk
_________________________________________________________

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```