# dstr: Helper Functionality for Constructing Distributions In distr6: The Complete R6 Probability Distributions Interface

## Description

Helper functions for constructing an SDistribution (with `dstr`) or VectorDistribution (with `dstrs`).

## Usage

 ```1 2 3``` ```dstr(d, ..., pars = NULL) dstrs(d, pars = NULL, ...) ```

## Arguments

 `d` (`character(1)`) Distribution. Can be the `ShortName` or `ClassName` from `listDistributions()`. `...` (`ANY`) Passed to the distribution constructor, should be parameters or `decorators`. `pars` (`list()`) List of parameters of same length as `d` corresponding to distribution parameters.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29``` ```# Construct standard Normal and distribution dstr("Norm") # ShortName dstr("Normal") # ClassName # Construct Binomial(5, 0.1) dstr("Binomial", size = 5, prob = 0.1) # Construct decorated Gamma(2, 1) dstr("Gamma", shape = 2, rate = 1, decorators = "ExoticStatistics") # Or with a list dstr("Gamma", pars = list(shape = 2, rate = 4)) # Construct vector with dstrs # Binomial and Gamma with default parameters dstrs(c("Binom", "Gamma")) # Binomial with set parameters and Gamma with # default parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), NULL)) # Binomial and Gamma with set parameters dstrs(c("Binom", "Gamma"), list(list(size = 4), list(rate = 2, shape = 3))) # Multiple Binomials dstrs("Binom", data.frame(size = 1:5, prob = 0.5)) ```

distr6 documentation built on Sept. 6, 2021, 9:10 a.m.