Learn R Programming

NPHazardRate (version 0.1)

SimpsonInt: Simpson numerical integration

Description

Implements Simpson's extended numerical integration rule

Usage

SimpsonInt(xin, h)

Arguments

xin

A vector of data points

h

grid length

Value

returns the approximate integral value

Details

The extended numerical integration rule is given by $$ \int_0^{x_{2n}} f(x)\,dx = \frac{h}{3}(f(x_0) + 4\{f(x_1) + \dots f(x_{2n-1}) \} +2 \{f(x_2) + f(x_4) + \dots f(x_{2n-2})\} + f(x_{2n})) -R_n $$

References

Weisstein, Eric W. "Simpson's Rule." From MathWorld--A Wolfram Web Resource