distcrete: Discretise a distribution

Description Usage Arguments Author(s) Examples

View source: R/distcrete.R

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

Author(s)

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)

reconhub/distcrete documentation built on Nov. 30, 2017, 11:21 a.m.