Integrates a Density Function

Share:

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

1
2
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)

David Scott d.scott@auckland.ac.nz

See Also

momIntegrated

Examples

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