| integrate.mstR {mstR} | R Documentation |
Numerical integration by linear interpolation (for mstR 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.mstR(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. |
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 mstR package to package sfsmisc.
Value
The approximated integral.
Author(s)
David Magis
Department of Psychology, University of Liege, Belgium
david.magis@uliege.be
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
The integrate.xy function in package sfsmisc
Examples
x <- seq(from = -4, to = 4, length = 33)
y <- exp(x)
integrate.mstR(x, y) # 54.86381
## Not run:
# Comparison with integrate.xy
require(sfsmisc)
integrate.xy(x, y, use.spline = FALSE) # 54.86381
integrate.xy(x, y) # 54.58058
## End(Not run)