### 8.4.5 Normal distributions

#### The probability density function for a normal distribution: normald loi_normal

The normald (or loi_normal) command returns the value of the normal probability density function. You can give it arguments of the mean µ, standard deviation σ and a value x then

normald(µ,σ,x) = |
1
√ |
2π
| σ
| e(x−µ)2/2

If you enter

normald(2,1,3)

you will get

exp(-1/2)/sqrt(2*pi)

If you don’t give the command values for µ and σ, then normald will use the values µ=0 and σ = 1, and so compute the standard normal density function. If you enter

normald(2)

you will get

1/(sqrt(2*pi)*exp(2))

#### The cumulative distribution function for normal distributions: normal_cdf normald_cdf

The command normal_cdf (or normald_cdf) computes the cumulative distribution function for the normal distribution. Like normald, you can give it the mean and standard deviation of the distribution; if you enter

normal_cdf(1,2,1.96)

you will get

0.684386303484

You can also leave off the mean and standard deviation, in which case normal_cdf will compute the cumulative distribution function for the standard normal distribution;

normal_cdf(1,2.1,1.2)

you will get

0.537937144066

If you give normal_cdf an extra argument (with or without the mean and standard deviation), you will get the probability that the random variable lies between two values; normal_cdf(x,y) = Prob(x ≤ X ≤ y). If you enter

normal_cdf(1,2.1,1.2,9)

you will get

0.461993238584

#### The inverse distribution function for normal distributions: normal_icdf normald_icdf

Given a value h, the inverse distribution function gives the value of x with Prob(X ≤ x) ≤ h. The normal_icdf (or normald_icdf) will compute the inverse distribution for the normal distribution. If no mean or standard deviation are given, the standard normal distribution will be used. If you enter

normal_icdf(0.975)

you will get

1.95996398454

You can, of course, also give the mean and standard deviation. If you enter

normal_icdf(1,2,0.495)

you will get

0.974933060984

#### The upper tail cumulative function for normal distributions: UTPN

The UTPN (the Upper Tail Probability - Normal distribution) will compute Prob(X > x). If you don’t give it a mean and variance, then it will compute the probability for the standard normal distribution. If you enter

UTPN(1.96)

you will get

0.0249978951482

You can also specify a mean and a variance, but note that unlike normald and normal_cdf, the UTPN requires the variance and not the standard deviation. If you enter

UTPN(1,4,1.96)

you will get

0.315613696516