[R] R2Cube integration errors

David Winsemius dwinsemius at comcast.net
Thu Jan 26 23:45:31 CET 2017


> On Jan 26, 2017, at 12:51 PM, George Trojan - NOAA Federal <george.trojan at noaa.gov> wrote:
> 
> Why this happens?
> 
>> library("R2Cuba")
>> f <- function(x) 0
>> cuhre(ndim=1, ncomp=1, f)
> Iteration 1:  11 integrand evaluations so far
> [1] 0 +- 0      chisq 0 (0 df)
> Iteration 2:  33 integrand evaluations so far
> [1] 0 +- 0      chisq 0 (1 df)
> integral: 0 (+-0)
> nregions: 2; number of evaluations:  33; probability:  0
>> vegas(ndim=1, ncomp=1, f)
> Iteration 1:  1000 integrand evaluations so far
> [1] 0 +- 7.02518e-18    chisq 0 (0 df)
> . . .
> Iteration 13:  52000 integrand evaluations so far
> [1] 0 +- 2.65413e-18    chisq 0 (12 df)
> integral: 0 (+-2.7e-18)
> number of evaluations:  52000; probability:  0
> failed with message  ‘Dimension out of range’
>> suave(ndim=1, ncomp=1, f)
> . . .
> [1] 0 +- 7.02462e-17    chisq 0 (411 df)
> integral: 0 (+-7e-17)
> nregions: 50; number of evaluations:  50000; probability:  0
> failed with message  ‘Dimension out of range’
> 
> Is this a bug?

If you look at the code you will see that the delivered message does not actually match what the documentation says should be delivered when 'ifail' is (positive) 1. Appears the package maintainer has not put in code to warn of failure to reach "the accuracy goal was not met within the allowed maximum number of integrand evaluations." That message is only supposed to be delivered when 'ifail' is -1.

> maintainer("R2Cuba")
[1] "Annie Bouvier <Annie.Bouvier at jouy.inra.fr>"



> 
> George
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list