Description Usage Arguments Details Value Author(s) References See Also Examples

UNU.RAN random variate generator for continuous distributions with given probability density function (PDF). It is based on the Inverse Transformed Density Rejection method (‘ITDR’).

[Universal] – Rejection Method.

1 2 |

`pdf` |
probability density function. ( |

`dpdf` |
derivative of |

`pole` |
pole of distribution. (numeric) |

`lb` |
lower bound of domain;
use |

`ub` |
upper bound of domain;
use |

`islog` |
whether |

`...` |
(optional) arguments for |

`distr` |
distribution object. (S4 object of class |

This function creates a `unuran`

object based on “ITDR”
(Inverse Transformed Density Rejection). It can be used to draw samples of a
continuous random variate with given probability density function
using `ur`

.

The density `pdf`

must be positive but need not be normalized
(i.e., it can be any multiple of a density function).
The algorithm is especially designed for distributions with unbounded
densities. Thus the algorithm needs the position of the `pole`

.
Moreover, the given function must be monotone on its domain.

The derivative `dpdf`

is essential. (Numerical derivation does
not work as it results in serious round-off errors.)

Alternatively, one can use function `itdrd.new`

where the object
`distr`

of class `"unuran.cont"`

must contain all required
information about the distribution.

The setup time of this method depends on the given PDF, whereas its marginal generation times are almost independent of the target distribution.

An object of class `"unuran"`

.

Josef Leydold and Wolfgang H\"ormann [email protected].

W. H\"ormann, J. Leydold, and G. Derflinger (2007): Inverse transformed density rejection for unbounded monotone densities. ACM Trans. Model. Comput. Simul. 17(4), Article 18, 16 pages. DOI: 10.1145/1276927.1276931

`ur`

,
`unuran.cont`

,
`unuran.new`

,
`unuran`

.

1 2 3 4 5 6 7 8 9 10 | ```
## Create a sample of size 100 for a Gamma(0.5) distribution
pdf <- function (x) { x^(-0.5)*exp(-x) }
dpdf <- function (x) { (-x^(-0.5) - 0.5*x^(-1.5))*exp(-x) }
gen <- itdr.new(pdf=pdf, dpdf=dpdf, lb=0, ub=Inf, pole=0)
x <- ur(gen,100)
## Alternative approach
distr <- udgamma(shape=0.5)
gen <- itdrd.new(distr)
x <- ur(gen,100)
``` |

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.