Last data update: 2014.03.03

R: Step Size for Calculating the Range of a Unimodal...
distStepSizeR Documentation

Step Size for Calculating the Range of a Unimodal Distribution

Description

Given the parameters of a unimodal distribution and the root of the density function name, this function determines the step size when calculating the range of the specified unimodal distribution. The parameterization used is the one for the corresponding density function calculation.

Usage

distStepSize(densFn, dist,
             param = NULL, side = c("right","left"), ...)

Arguments

densFn

Character. The name of the density function for which the step size needs to be calculated.

dist

Numeric. Current distance value, for skew hyperbolic distribution only

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.

side

Character. "right" for a step to the right, "left" for a step to the right.

...

Passes arguments in particular the parameters of the distribution to random sample generation function.

Details

This function is used for stepping to the right or the left to obtain an enclosing interval so uniroot can be used to search. The step size for the right tail is the absolute difference between the median and upper quantile and for the left tail is the absolute difference between the median and lower quantile. The skew hyperbolic distribution however needs a special step size. When the tail is declining exponentially the step is just a linear function of the current distance from the mode. If the tail is declining only as a power of x, an exponential step is used.

distStepSize is for internal use and is not expected to be called by users. It is documented here for completeness.

Value

The size of the step.

Author(s)

David Scott d.scott@auckland.ac.nz, Joyce Li xli053@aucklanduni.ac.nz

See Also

distCalcRange

Examples

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/distStepSize.Rd_%03d_medium.png", width=480, height=480)
> ### Name: distStepSize
> ### Title: Step Size for Calculating the Range of a Unimodal Distribution
> ### Aliases: distStepSize
> ### 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 
>