In the previous tutorial we looked at multivariate distributions and how to use the d/p/q/r functions to evaluate multiple points of these. This tutorial concludes the ‘Basic’ set of tutorials with the use of ‘listing’ in distr6.
Currently distr6 includes 5 listing functions:
listDistributions(), listDecorators(), listWrappers(), listKernels(), listSpecialSets(). These are essentially ways of listing the R6 classes implemented in the R6 API. We will only discuss the
listDistributions() function here as the others cover classes that we haven’t discussed yet, but hopefully are intuitive to you and have a similar interface to
listDistributions() is used to list every implemented probability distribution in distr6. The default parameters return a data.table of every implemented distribution including their traits and the package that their d/p/q/r methods are implemented in. For example a distribution with package
stats means that the d/p/q/r methods interface the R stats functions whereas a distribution with package
distr6 means the methods are written in distr6. We’ve added the
head() method just to save space.
head(listDistributions()) #> ShortName ClassName Type ValueSupport VariateForm Package #> 1: Arc Arcsine ℝ continuous univariate distr6 #> 2: Bern Bernoulli ℕ0 discrete univariate stats #> 3: Beta Beta ℝ+ continuous univariate stats #> 4: BetaNC BetaNoncentral ℝ+ continuous univariate stats #> 5: Binom Binomial ℕ0 discrete univariate stats #> 6: Cat Categorical ℂ discrete univariate distr6
To see a simplified version of the list, add the
simplify = TRUE argument
Finally this list can be filtered to help you find a distribution with specific traits, for example for a multivariate distribution
head(listDistributions(filter = list(variateform = "multivariate"))) #> ShortName ClassName Type ValueSupport VariateForm Package #> 1: Diri Dirichlet [0,1]^K continuous multivariate distr6 #> 2: Multinom Multinomial ℕ0^K discrete multivariate stats #> 3: MultiNorm MultivariateNormal ℝ^K continuous multivariate distr6 # The trait name is case-insensitive head(listDistributions(filter = list(VaRiAtEfORm = "multivariate"))) #> ShortName ClassName Type ValueSupport VariateForm Package #> 1: Diri Dirichlet [0,1]^K continuous multivariate distr6 #> 2: Multinom Multinomial ℕ0^K discrete multivariate stats #> 3: MultiNorm MultivariateNormal ℝ^K continuous multivariate distr6
Or for multiple filters:
In this tutorial we looked at the
listDistributions() function so that you don’t have to remember which are implemented in distr6. In this set of tutorials we covered the basics of constructing a (univariate) distribution, getting and setting parameters, evaluating statistical results and extending all this to multivariate distributions. The next set of tutorials cover more advanced functionality including decorators for numeric results, wrappers for composite distributions, custom distributions, S3 functionality, and symbolic sets.