Learn R Programming

acopula (version 0.9.4)

nintegrate: Numerical integration

Description

Trapezoidal integration of an arbitrarily dimensional function.

Usage

nintegrate(fun, lower, upper, subdivisions=100, differences=(upper-lower)/subdivisions)

Value

Numeric.

Arguments

fun

function. Arguments can be in sequence or single vector.

lower,upper

numeric (vector). Upper and lower bound of integration. Either one of these or differences should have length of function dimension.

subdivisions

numeric (vector). Number of bins.

differences

numeric. Width of bins.

Author

Tomas Bacigal

See Also

nderive

Examples

Run this code
##cumulative distribution function of a bivariate normal copula 
##evaluated at point c(0.5,0.6); compare pCopula(c(0.5,0.6),cop=copNormal(),par=0.5)
nintegrate(function(x) dCopula(x,cop=copNormal(),par=0.5), 
  lower=0.001, upper=c(0.5,0.6), subdivisions=20) 

Run the code above in your browser using DataLab