The Normal distribution is ubiquitous in statistics, partially because of the central limit theorem, which states that sums of i.i.d. random variables eventually become Normal. Linear transformations of Normal random variables result in new random variables that are also Normal. If you are taking an intro stats course, you'll likely use the Normal distribution for Z-tests and in simple linear regression. Under regularity conditions, maximum likelihood estimators are asymptotically Normal. The Normal distribution is also called the gaussian distribution.

`dist_normal(mu = 0, sigma = 1, mean = mu, sd = sigma)`

- mu, mean
The mean (location parameter) of the distribution, which is also the mean of the distribution. Can be any real number.

- sigma, sd
The standard deviation (scale parameter) of the distribution. Can be any positive number. If you would like a Normal distribution with

**variance**\(\sigma^2\), be sure to take the square root, as this is a common source of errors.

We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

In the following, let \(X\) be a Normal random variable with mean
`mu`

= \(\mu\) and standard deviation `sigma`

= \(\sigma\).

**Support**: \(R\), the set of all real numbers

**Mean**: \(\mu\)

**Variance**: \(\sigma^2\)

**Probability density function (p.d.f)**:

$$ f(x) = \frac{1}{\sqrt{2 \pi \sigma^2}} e^{-(x - \mu)^2 / 2 \sigma^2} $$

**Cumulative distribution function (c.d.f)**:

The cumulative distribution function has the form

$$ F(t) = \int_{-\infty}^t \frac{1}{\sqrt{2 \pi \sigma^2}} e^{-(x - \mu)^2 / 2 \sigma^2} dx $$

but this integral does not have a closed form solution and must be approximated numerically. The c.d.f. of a standard Normal is sometimes called the "error function". The notation \(\Phi(t)\) also stands for the c.d.f. of a standard Normal evaluated at \(t\). Z-tables list the value of \(\Phi(t)\) for various \(t\).

**Moment generating function (m.g.f)**:

$$ E(e^{tX}) = e^{\mu t + \sigma^2 t^2 / 2} $$

```
dist <- dist_normal(mu = 1:5, sigma = 3)
dist
#> <distribution[5]>
#> [1] N(1, 9) N(2, 9) N(3, 9) N(4, 9) N(5, 9)
mean(dist)
#> [1] 1 2 3 4 5
variance(dist)
#> [1] 9 9 9 9 9
skewness(dist)
#> [1] 0 0 0 0 0
kurtosis(dist)
#> [1] 0 0 0 0 0
generate(dist, 10)
#> [[1]]
#> [1] 0.4950423 0.4769911 3.4436517 2.0247958 -0.8073936 6.8221861
#> [7] -1.3787337 3.8308699 -0.9895047 6.6092805
#>
#> [[2]]
#> [1] -3.6553304 -1.3249556 -2.4350495 2.0687203 1.2647903 2.4822470
#> [7] 1.4164574 -0.3430929 0.8494276 -0.5715459
#>
#> [[3]]
#> [1] 3.7380169 6.0612097 -0.2335897 3.3886790 2.6105498 5.0537887
#> [7] -0.7533917 6.9572624 8.9509635 5.6966936
#>
#> [[4]]
#> [1] 3.90947967 0.39974107 5.38714324 2.39579591 3.27097743 4.14514469
#> [7] 1.26730979 -0.01208239 9.76528566 4.29041485
#>
#> [[5]]
#> [1] 3.808100 5.356915 -2.095942 3.303020 1.840831 2.056747 9.607398
#> [8] 3.929207 6.416660 6.112311
#>
density(dist, 2)
#> [1] 0.12579441 0.13298076 0.12579441 0.10648267 0.08065691
density(dist, 2, log = TRUE)
#> [1] -2.073106 -2.017551 -2.073106 -2.239773 -2.517551
cdf(dist, 4)
#> [1] 0.8413447 0.7475075 0.6305587 0.5000000 0.3694413
quantile(dist, 0.7)
#> [1] 2.573202 3.573202 4.573202 5.573202 6.573202
```