View source: R/DroppingInterval.R

interval2rate | R Documentation |

Conversion of interval estimates to rates

interval2rate( data, minint = data$mu/100, maxint = data$mu + 3 * data$sigma, digits = max(3L, getOption("digits") - 3L), method = "exact" )

`data` |
An object of class |

`minint` |
the minimum interval value from which numerical integrations converting to rates are started |

`maxint` |
the maximum interval value up to which numerical integrations converting to rates are continued |

`digits` |
the number of digits for printing to screen |

`method` |
A string equal to 'exact' or 'taylor'. When 'exact' exact formula or numeric integration is used. When 'taylor' a Taylor approximation is used as in standard propagation of uncertainty in the case of division. |

When inter-arrival times (intervals) follow a gamma distribution with mean *μ* and
standard deviation *σ*, i.e. follow the probability density function
`GammaDist(shape=`

*α=μ^2/σ^2*`, scale=`

*β=σ^2/μ)*,
then the associated distribution of rates is given by an inverse gamma distribution
with shape parameter *α* and scale parameter *1/β*.

The mean of this inverse gamma distribution is given by the formula

*μ_{rate}=μ/(μ^2 - σ^2)*

provided that *α > 1*, i.e. *μ > σ*.

The variance of this inverse gamma distribution is given by the formula

*σ^2_{rate}=μ^2σ^2/((μ^2 - σ^2)(μ^2 - 2σ^2)^2*

provided that *α > 2*, i.e. *μ > sqrt(2) * σ*.

Values *μ* and *σ* are estimated on the interval data, and
above formula are used to calculate the estimated mean and variance of the arrival rate.

If these formula cannot be used (because the provisions on the value
of *α* are not met), numerical integration is used instead,
analagous to the procedure for normal-distributed intervals, see below.

When inter-arrival times (intervals) *x* follow a normal distribution with mean *μ* and
standard deviation *σ*, i.e. follow the probability density function
`Normal(mean=`

*μ*`, sd=`

*σ)*,
then the mean rate (*μ_{rate}*) can be calculated numerically by:

*μ_{rate}=\int_0^∞ (1/x) * φ(x | μ,σ)*

and the variance of the rate (*σ^2_{rate}*) by:

*σ^2_{rate}=\int_0^∞ (1/x^2) * φ(x | μ,σ) -μ_{rate}^2*

This approximation is only valid for distributions that have a negligable
density near *x=0*, such that the distribution can be effectively
truncated before *x* approaches zero, where the integral is not defined.
For interval data with intervals *x*
near zero, use of a gamma distribution is recommended instead.

The function `interval2rate`

computes and returns a named vector with the rate mean and standard deviation

data(goosedrop) dr=estinterval(goosedrop$interval) interval2rate(dr)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.