dirwin.hall {unifed}R Documentation

Irwin-Hall density

Description

Irwin-Hall density

Usage

dirwin.hall(x, n, log = FALSE)

Arguments

x

A number between 0 and n.

n

Number of uniform distributions in the unit interval to sum.

log

If it evaluates to TRUE it returns the log of the density instead of the density.

Details

Gives the density of the Irwin-Hall distribution. It is the density of the sum of n uniform distributions on the interval (0,1).

h(y;n) = \frac{1}{(n-1)!}\sum_{k=0}^{ \left\lfloor y \right\rfloor } (-1)^k {n \choose k} (y-k)^{n-1}

where x \in [0,1] and n is a positive integer.

This function is not numerically stable. The examples have some cases of this.

Examples


dirwin.hall(2,5)

# Numerically unstable example
# Run the following one after the other
# See how it goes from positive to negative (which means overflowing )
dirwin.hall(35,50)
dirwin.hall(36,50)
dirwin.hall(37,50)
dirwin.hall(38,50)


[Package unifed version 1.1.6 Index]