Hi,

  In your function cover, lambda1 and lambda2 are used but not in the
argument of the function.  I suppose that you need to have lambda1 and
lambda2 in the argument of the function cover, like function(lambda1,
lambda2, n, significance.level).  

  Give it a try.

cover <- function(lambda, n, significance.level)  {
  s1 <- rpois(1,lambda1) 
  s2 <- rpois(1,lambda2) 
  theta <- lambda2/(lambda1+lambda2) 
  s <- s1+s2 
  z <- qnorm(1-0.05/2) 
  k <- z^2 
  pi <- s2/s 
  lower <- (pi+(k/(2*s))-z*sqrt((pi*(1-pi)+(k/4*s))/s))/(1+k/s) 
  upper <- (pi+(k/(2*s))+z*sqrt((pi*(1-pi)+(k/4*s))/s))/(1+k/s) 
  if (theta >= lower & theta <= upper){1} else {0} 
}



--
View this message in context: 
http://r.789695.n4.nabble.com/Coverage-probability-for-a-Poisson-parameter-tp4702535p4703230.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to