| gauss_quad | R Documentation | 
This family of functions use quadratures for solving integrals. The user can create a custom integration routine, see details for further information.
gauss_quad(
  fun,
  lower,
  upper,
  kind = "legendre",
  n = 10,
  normalized = FALSE,
  ...
)
fun | 
 an R function which should take a numeric argument x and
possibly some parameters. The function returns a numerical vector
value for the given argument   | 
lower | 
 a numeric value for the lower limit of the integral.  | 
upper | 
 a numeric value for the upper limit of the integral.  | 
kind | 
 character specifying the weight (polynomial) function for the quadrature.  | 
n | 
 integer with the highest order of the polynomial of the selected rule.  | 
normalized | 
 logical. If TRUE, rules are for orthonormal polynomials, otherwise they are for orthogonal polynomials.  | 
... | 
 additional arguments to be passed to   | 
gauss_quad uses the implementation of Gaussian quadratures from
gaussquad package.This is a wrapper that implements rules
and integration routine in the same place.
The value of the integral of the function specified in fun
argument.
Jaime Mosquera GutiƩrrez, jmosquerag@unal.edu.co
laguerre.quadrature,
legendre.quadrature,
chebyshev.c.quadrature,
gegenbauer.quadrature,
hermite.h.quadrature, etc.
library(EstimationTools)
#----------------------------------------------------------------------------
# Example 1: Mean of X ~ N(2,1) (Gauss-Hermitie quadrature).
g <- function(x, mu, sigma) sqrt(2)*sigma*x + mu
i2 <- gauss_quad(g, lower = -Inf, upper = Inf, kind = 'hermite.h',
                 normalized = FALSE, mu = 2, sigma = 1)
i2 <- i2/sqrt(pi)
i2
#----------------------------------------------------------------------------
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.