Discretise a distribution.

distcrete(name, interval, ..., w = 0.5, anchor = 0)

## Arguments

name |
The name of a distribution function (e.g.,
`norm` , `gamma` ). The distribution must have a cdf
function (e.g., `pnorm` ) and a quantile function (e.g.,
`qnorm` ) defined. |

interval |
The interval to discretise the interval onto. |

... |
Parameters to `cdf` . Can be matched positionally
or by name. |

w |
How to weight the endpoints; must be between 0 and 1. If
0.5 then integration happens centred around the interval, if 0
floor, if 1 then ceiling. |

anchor |
Any location that is a valid `x` |

## Examples

#> [1] 0.243022187 0.253486335 0.185086776 0.113451286 0.062683215 0.032332641
#> [7] 0.015882196 0.007521773 0.003462799 0.001558522

d0$p(c(.1,.5))

#> [1] 0.09958372 0.19115317

d0$q(c(.1,.5))

#> [1] 0 1

d0$r(10)

#> [1] 2 3 1 2 12 2 2 4 5 3