| distrExIntegrate {distrEx} | R Documentation |
Numerical integration via integrate. In case integrate
fails a Gauss-Legendre quadrature is performed.
distrExIntegrate(f, lower, upper, subdivisions = 100,
rel.tol = .Machine$double.eps^0.25,
abs.tol = rel.tol, stop.on.error = TRUE,
distr, order, ...)
f |
an R function taking a numeric first argument and returning a numeric vector of the same length. Returning a non-finite element will generate an error. |
lower |
lower limit of integration. Can be |
upper |
upper limit of integration. Can be |
subdivisions |
the maximum number of subintervals. |
rel.tol |
relative accuracy requested. |
abs.tol |
absolute accuracy requested. |
stop.on.error |
logical. If |
distr |
object of class |
order |
order of Gauss-Legendre quadrature. |
... |
additional arguments to be passed to |
This function calls integrate. In case integrate
returns an error a Gauss-Legendre integration is performed using
GLIntegrate. If lower or (and) upper are infinite
the GLIntegrateTruncQuantile, respectively the
1-GLIntegrateTruncQuantile quantile of distr is used
instead.
Estimate of the integral.
Matthias Kohl Matthias.Kohl@stamats.de
Based on QUADPACK routines dqags and dqagi by
R. Piessens and E. deDoncker-Kapenga, available from Netlib.
R. Piessens, E. deDoncker-Kapenga, C. Uberhuber, D. Kahaner (1983) Quadpack: a Subroutine Package for Automatic Integration. Springer Verlag.
W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery (1992) Numerical Recipies in C. The Art of Scientific Computing. Second Edition. Cambridge University Press.
integrate, GLIntegrate,
distrExOptions
fkt <- function(x){x*dchisq(x+1, df = 1)}
integrate(fkt, lower = -1, upper = 3)
GLIntegrate(fkt, lower = -1, upper = 3)
try(integrate(fkt, lower = -1, upper = 5))
distrExIntegrate(fkt, lower = -1, upper = 5)