Integrate: the integral is probably divergent

后端 未结 2 972
遥遥无期
遥遥无期 2021-01-19 23:50

I was doing some integration into a loop using integrate and I come up with an error I can\'t understand neither get rid of. Here is a MWE I could extract:

2条回答
  •  情话喂你
    2021-01-20 00:03

    The default tolerance of .Machine$double.eps^0.25 (= 0.0001220703) needs to be lowered. Try, for example, this:

    f <- function(v) pnorm(v, mean = m, sd = s, lower.tail =  FALSE)
    integrate(f, u_min, u_max, rel.tol = 1e-15)
    
    ## 0.0009421867 with absolute error < 1.1e-17
    

提交回复
热议问题