Distributions in R

Robert W. Walker

September 11, 2017

Distributions in R

Break down simply into

The normal is norm

The empirical rule.

pnorm(2)-pnorm(-2)
## [1] 0.9544997

Plotting the Normal: r is random

The meat is in p and q

VonBort

Comparing the deaths to a hypothetical.

How to Deploy this… Binomial

Four commands

* rbinom(sample.size, n, p(yes))
* dbinom(x, n, p(yes))
* pbinom(x, n, p(yes))
* qbinom(p, n, p(yes))

Poisson

Four commands

* rpois(sample.size, lambda)
* dpois(x, lambda)
* ppois(x, lambda
* qpois(p, lambda)

Uniform

Four commands

* runif(sample.size, a, b)
* dunif(x, a, b)
* punif(x, a, b)
* qunif(p, a, b)

Normal

Four commands

* rnorm(sample.size, mu, sig)
* dnorm(x, mu, sig)
* pnorm(x, mu, sig)
* qnorm(p, mu, sig)

Some Other Commands

plot(density(data)) or hist(data) show samples.
The assignment operator or equals to save samples <- or =
What values can x take? `poss.x <- seq(min.x, max.x, by=units)