Learn R Programming

catR (version 3.16)

integrate.catR: Numerical integration by linear interpolation (for catR internal use)

Description

This command computes the integral of function f(x) by providing values of x and f(x), similarly to the integrate.xy function of the R package sfsmisc.

Usage

integrate.catR(x, y)

Arguments

x

numeric: a vector of x values for numerical integration.

y

numeric: a vector of numerical values corresponding to f(x) values.

Value

The approximated integral.

Details

This function was written to compute "cheap" numerical integration by providing sequences of x values and corresponding computed values f(x). It works similarly as the integrate.xy function when use.spline=FALSE is required. It was developed internally to eventually remove dependency of catR package to package sfsmisc.

References

Maechler, M. et al. (2012). sfsmisc: Utilities from Seminar fuer Statistik ETH Zurich. R package version 1.0-23. http://CRAN.R-project.org/package=sfsmisc

See Also

KL and the integrate.xy function in package sfsmisc

Examples

Run this code
# NOT RUN {
 # Loading the 'tcals' parameters 
 x <- seq(from = -4, to = 4, length = 33)
 y <- exp(x)
 integrate.catR(x, y) # 54.86381

 
# }

Run the code above in your browser using DataLab