Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

distribution

Empirical Distributions


Description

Generate a sequence of n-quantiles, i.e., a sample of size n with a near-perfect distribution.

Usage

distribution(type = "normal", ...)

distribution_custom(n, type = "norm", ..., random = FALSE)

distribution_beta(n, shape1, shape2, ncp = 0, random = FALSE, ...)

distribution_binomial(n, size = 1, prob = 0.5, random = FALSE, ...)

distribution_binom(n, size = 1, prob = 0.5, random = FALSE, ...)

distribution_cauchy(n, location = 0, scale = 1, random = FALSE, ...)

distribution_chisquared(n, df, ncp = 0, random = FALSE, ...)

distribution_chisq(n, df, ncp = 0, random = FALSE, ...)

distribution_gamma(n, shape, scale = 1, random = FALSE, ...)

distribution_mixture_normal(n, mean = c(-3, 3), sd = 1, random = FALSE, ...)

distribution_normal(n, mean = 0, sd = 1, random = FALSE, ...)

distribution_gaussian(n, mean = 0, sd = 1, random = FALSE, ...)

distribution_nbinom(n, size, prob, mu, phi, random = FALSE, ...)

distribution_poisson(n, lambda = 1, random = FALSE, ...)

distribution_student(n, df, ncp, random = FALSE, ...)

distribution_t(n, df, ncp, random = FALSE, ...)

distribution_student_t(n, df, ncp, random = FALSE, ...)

distribution_tweedie(n, xi = NULL, mu, phi, power = NULL, random = FALSE, ...)

distribution_uniform(n, min = 0, max = 1, random = FALSE, ...)

rnorm_perfect(n, mean = 0, sd = 1)

Arguments

type

Can be any of the names from base R's Distributions, like "cauchy", "pois" or "beta".

...

Arguments passed to or from other methods.

n

the number of observations

random

Generate near-perfect or random (simple wrappers for the base R r* functions) distributions.

shape1

non-negative parameters of the Beta distribution.

shape2

non-negative parameters of the Beta distribution.

ncp

non-centrality parameter.

size

number of trials (zero or more).

prob

probability of success on each trial.

location

location and scale parameters.

scale

location and scale parameters.

df

degrees of freedom (non-negative, but can be non-integer).

shape

shape and scale parameters. Must be positive, scale strictly.

mean

vector of means.

sd

vector of standard deviations.

mu

the mean

phi

Corresponding to glmmTMB's implementation of nbinom distribution, where size=mu/phi.

lambda

vector of (non-negative) means.

xi

the value of xi such that the variance is var(Y) = phi * mu^xi

power

a synonym for xi

min

lower and upper limits of the distribution. Must be finite.

max

lower and upper limits of the distribution. Must be finite.

Examples

library(bayestestR)
x <- distribution(n = 10)
plot(density(x))

x <- distribution(type = "gamma", n = 100, shape = 2)
plot(density(x))

bayestestR

Understand and Describe Bayesian Models and Posterior Distributions

v0.10.0
GPL-3
Authors
Dominique Makowski [aut, cre] (<https://orcid.org/0000-0001-5375-9967>, @Dom_Makowski), Daniel Lüdecke [aut] (<https://orcid.org/0000-0002-8895-3206>, @strengejacke), Mattan S. Ben-Shachar [aut] (<https://orcid.org/0000-0002-4287-4801>, @mattansb), Indrajeet Patil [aut] (<https://orcid.org/0000-0003-1995-6531>, @patilindrajeets), Michael D. Wilson [aut] (<https://orcid.org/0000-0003-4143-7308>), Paul-Christian Bürkner [rev], Tristan Mahr [rev] (<https://orcid.org/0000-0002-8890-5116>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>), Quentin F. Gronau [ctb] (<https://orcid.org/0000-0001-5510-6943>), Sam Crawley [ctb] (<https://orcid.org/0000-0002-7847-0411>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.