Hi, Some suggestion about the arguments of the function defined below. Since theta is calculated with the value of lambda1 and lambda2, there is no need to include theta in the argument. Or, your function can be defined as function(lambda1, lambda2, significance.level)
cover <- function(theta, lambda1, lambda2, 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 root <- ((s2/s)*(1-s2/s)+k/(4*s))^(1/2) low <- (s2+k/2)/(s+k)-((z*sqrt(s))/(s+k))*root hig <- (s2+k/2)/(s+k)+((z*sqrt(s))/(s+k))*root if (theta >= low & theta <= hig){1} else {0} } -- View this message in context: http://r.789695.n4.nabble.com/Coverage-probability-for-a-Poisson-parameter-tp4702535p4703248.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.