Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

integrateDens

Integrates a Density Function


Description

Given a density function specified by the root of the density function name, returns the integral over a specified range, usually the whole real line. Used for checking that the integral over the whole real line is 1.

Usage

integrateDens(densFn = "norm", lower = -Inf, upper = Inf,
              subdivisions = 100, ...)

Arguments

densFn

Character. The name of the density function to be integrated.

lower

Numeric. The lower limit of the integration. Defaulty is -Inf.

upper

Numeric. The upper limit of the integration. Defaulty is Inf.

subdivisions

Numeric. The number of subdivisions to be passed to integrate.

...

Additional arguments to be passed to integrate. In particular, the parameters of the distribution.

Details

The name of the density function to be integrated must be supplied as the characters of the root for that density (e.g. norm, gamma). The density function specified is integrated numerically over the range specified via a call to integrate. The parameters of the distribution can be specified, otherwise the default parameters will be used.

Value

A list of class integrate with components:

value

The final estimate of the integral.

abs.error

Estimate of the modulus of the absolute error.

subdivisions

The number of subintervals produced in the subdivision process.

message

OK or a character string giving the error message.

call

The matched call to the integrate function.

Author(s)

See Also

Examples

integrateDens("norm", mean = 1, sd = 1)
integrateDens("t", df = 4)
integrateDens("exp", rate = 2)
integrateDens("weibull", shape = 1)

DistributionUtils

Distribution Utilities

v0.6-0
GPL (>= 2)
Authors
David Scott <d.scott@auckland.ac.nz>
Initial release
2018-11-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.