# distcrete: Discretise a distribution In distcrete: Discrete Distribution Approximations

## Description

Discretise a distribution.

## Usage

 `1` ```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`

Rich FitzJohn

## Examples

 ```1 2 3 4 5 6 7``` ```library(distcrete) set.seed(415) d0 <- distcrete("gamma", 1, shape = 3, w = 0) d0\$d(1:10) d0\$p(c(.1,.5)) d0\$q(c(.1,.5)) d0\$r(10) ```

### Example output

```  0.243022187 0.253486335 0.185086776 0.113451286 0.062683215 0.032332641
 0.015882196 0.007521773 0.003462799 0.001558522
 0.09958372 0.19115317
 0 1
  2  3  1  2 12  2  2  4  5  3
```

distcrete documentation built on May 2, 2019, 4 p.m.