suave: Integration with SUbregion-Adaptive Vegas Algorithm

Description Usage Arguments Details Value References See Also Examples

View source: R/suave.R

Description

Suave uses vegas-like importance sampling combined with a globally adaptive subdivision strategy: Until the requested accuracy is reached, the region with the largest error at the time is bisected in the dimension in which the fluctuations of the integrand are reduced most. The number of new samples in each half is prorated for the fluctuation in that half.

Usage

1
2
3
4
5
6
suave(ndim, ncomp, integrand, ...,
      lower=rep(0,ndim), upper=rep(1,ndim),
      rel.tol= 0.001, abs.tol = 0,
      flags=list(verbose=1, final=1, pseudo.random=0, smooth=0, mersenne.seed=NULL),
      min.eval=0,  max.eval=50000,
      nnew=1000, flatness= 50)

Arguments

ndim

same as cuhre

ncomp

same as cuhre

integrand

same as cuhre; But, here, the input argument phw contains the weight of the point being sampled. This extra value can safely be ignored.

...

same as cuhre

lower

same as cuhre

upper

same as cuhre

rel.tol

same as cuhre

abs.tol

same as cuhre

flags

same as cuhre. flags may have an additional component: smooth. When = 0, apply additional smoothing to the importance function, this moderately improves convergence for many integrands. When = 1 , use the importance function without smoothing, this should be chosen if the integrand has sharp edges.

min.eval

same as cuhre

max.eval

same as cuhre

nnew

the number of new integrand evaluations in each subdivision.

flatness

This parameter determines how prominently “outliers”, i.e. individual samples with a large fluctuation, figure in the total fluctuation, which in turn determines how a region is split up. As suggested by its name, flatness should be chosen large for “flat” integrands and small for “volatile” integrands with high peaks. Note that since flatness appears in the exponent, one should not use too large values (say, no more than a few hundred) lest terms be truncated internally to prevent overflow. More details about this parameter can be found Hahn's paper from 2005 and in Cuba documentation.

Details

See details in the documentation.

Value

Idem as cuhre

References

T. Hahn (2005) CUBA-a library for multidimensional numerical integration. Computer Physics Communications, 168, 78-95.

See Also

cuhre, divonne, vegas

Examples

1
2
3
4
5
6
7
8
9
integrand <- function(arg, weight) {
  x <- arg[1]
  y <- arg[2]
  z <- arg[3]
  ff <- sin(x)*cos(y)*exp(z);
return(ff)
} # end integrand
suave(3, 1, integrand, rel.tol=1e-3,  abs.tol=1e-12,
             flags=list(verbose=2, final=0))

Example output

Suave input parameters:
  ndim 3
  ncomp 1
  rel.tol 0.001
  abs.tol 1e-12
  smooth 0
  pseudo.random  0
  final 0
  verbose 2
  min.eval 0
  max.eval 50000
  nnew 1000
  flatness 50
Iteration 1:  1000 integrand evaluations so far
[1] 0.664916 +- 0.0138647  	chisq 0 (0 df)
Iteration 2:  2000 integrand evaluations so far
[1] 0.664343 +- 0.0046336  	chisq 0.00737292 (2 df)
Iteration 3:  3000 integrand evaluations so far
[1] 0.664623 +- 0.0026616  	chisq 1.09695 (5 df)
Iteration 4:  4000 integrand evaluations so far
[1] 0.664393 +- 0.00118042  	chisq 1.60235 (8 df)
Iteration 5:  5000 integrand evaluations so far
[1] 0.664433 +- 0.000802054  	chisq 2.52582 (12 df)
Iteration 6:  6000 integrand evaluations so far
[1] 0.664746 +- 0.000612748  	chisq 4.38844 (16 df)
integral: 0.6647464 (+-0.00061)
nregions: 6; number of evaluations:  6000; probability:  0.001946077 

R2Cuba documentation built on May 29, 2017, 7:53 p.m.