Given the parameters of a unimodal distribution and the root of
the density function name, this function determines the range outside
of which the density function is negligible, to a specified
tolerance.
Usage
distCalcRange(densFn, param = NULL, tol = 10^(-5), ...)
Arguments
densFn
Character. The name of the density function for which
range calculation is required.
tol
Tolerance.
param
Numeric. A vector giving the parameter values for the
distribution specified by densFn. If no param values
are specified, then the default parameter values of each
distribution are used instead.
...
Passes arguments to uniroot.In
particular, the parameters of the distribution.
Details
The name of the unimodal density function must be supplied as the
characters of the root for that density (e.g. norm,
ghyp). The particular unimodal distribution being considered is
specified by the values of the parameters or of the
param vector.
The function gives a range, outside of which
the density is less than the given tolerance. It is used in
determining break points for the separate sections over which
numerical integration is used to determine the distribution
function. The points are found by using uniroot on the
density function.
Value
A two-component vector giving the lower and upper ends of the range.
normRange <- distCalcRange("norm", tol = 10^(-7), mean = 4, sd = 1)
normRange
tRange <- distCalcRange("t", tol = 10^(-5), df = 4)
tRange
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DistributionUtils)
Loading required package: RUnit
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DistributionUtils/distCalcRange.Rd_%03d_medium.png", width=480, height=480)
> ### Name: distCalcRange
> ### Title: Range of a Unimodal Distribution
> ### Aliases: distCalcRange
> ### Keywords: distribution univar
>
> ### ** Examples
>
> normRange <- distCalcRange("norm", tol = 10^(-7), mean = 4, sd = 1)
> normRange
[1] -1.513482 9.513466
> tRange <- distCalcRange("t", tol = 10^(-5), df = 4)
> tRange
[1] -16.31539 16.31539
>
>
>
>
>
> dev.off()
null device
1
>