# Re: [R] poisson mean hypothesis

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Mon 12 Sep 2005 - 19:33:13 EST

you could use something like the following (in case of two-group comparisons make the proper adjustements):

pois.test <- function(x, alternative = c("two.sided", "less", "greater"), mu){

alternative <- match.arg(alternative)     if (missing(mu) || (length(mu) != 1 || is.na(mu)))

stop("'mu' must be a single number")     nx <- length(x)
mu.x <- mean(x)
stat <- (mu.x - mu) / sqrt(mu.x/nx)
p.value <- switch(alternative,

```        "two.sided" = 2 * pnorm(-abs(stat)),
"less" = pnorm(stat),
"greater" = pnorm(stat, lower = FALSE))
```
list("sample mean" = mu.x, "null mean" = mu, "alternative" = alternative,

statistic = stat, p.value = p.value) }

```################

```

y <- rpois(50, 5)
pois.test(y, alt = "g", mu = 4)

y <- rpois(30, 15)
pois.test(y, alt = "l", mu = 16)

I hope it helps.

Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

```Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm

```
• Original Message ----- From: "Jan Wijffels" <Jan.Wijffels@ucs.kuleuven.be> To: <r-help@stat.math.ethz.ch> Sent: Monday, September 12, 2005 10:01 AM Subject: [R] poisson mean hypothesis

> Dear R-users,
> Is there a way to get p-values for a one-sided hypothesis test about
> a
> poisson mean?
>
> Thanks,
>
> Jan Wijffels
> University Center for Statistics
> W. de Croylaan 54
> 3001 Heverlee
> Belgium
> tel: +32 (0)16 322784
> fax: +32 (0)16 322831
> <http://www.kuleuven.be/ucs> http://www.kuleuven.be/ucs
>
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Sep 12 19:35:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:09 EST