Dear all,
I need to do some calculation where the code used are below. I get
error message when I choose k to be large, say greater than 25.
The error message is
"Error in integrate(temp, lower = 0, upper = 1, k, x, rho, m) :
the integral is probably divergent".
Can anyone give some help on resolving this. Thanks.
Hannah
m <- 100
alpha <- 0.05
rho <- 0.1
F0 <- function(y,x,rho){
pnorm((qnorm(x, lower.tail = F)-sqrt(rho)*qnorm(y, lower.tail = F))/sqrt(1-
rho), lower.tail = F)
}
temp <- function(y,k,x,rho,m) {
t <- F0(y=y, x=x, rho=rho)
pbinom(q=k, size=m, prob=t, lower.tail = F, log.p = FALSE)
}
est <- function(k,x,rho,m) {
integrate(temp, lower = 0, upper=1, k,x, rho,m)$value-alpha}
estf <- function(x){est(x, k=30, rho=rho, m=m)}
thre <- uniroot(estf, c(0,1), tol=1/10^12)$root
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
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.