# Practice 7 Working with the Normal Distribution

## 7.1 Directions

In this practice exercise, you will work with the normal distributionin R.

## 7.2 A closer look at the code

In this practice, you will learn about the `pnorm()`

and `qnorm`

commands.

### 7.2.1 Let’s learn to use the `pnorm()`

command

The r code window below will calculate and plot the probability that a normally distributed random variable is less than `value`

. You can change the mean, standard deviation, and value.

Experiment with the settings of mean, standard deviation, and value.

You can get help on any command in R by typing `?`

in font of the name of the command. Do so in the R code window below.

The `pnorm()`

command has four arguments that we need to be concerned about.

`q`

which holds the value to find the probability of being less than or greater than`mean`

which holds the mean of the normal distribution`sd`

which holds the standard deviation of the normal distribution`lower.tail`

which is set to true for a less than calculation or false for a greater than calculation.

Here are a few examples from the voice thread.

```
# P(X <= 70) X ~ N(75,5)
pnorm(q=70, mean=75, sd=5, lower.tail=T)
```

`## [1] 0.1586553`

```
# P(X >= 85) X ~ N(75,5)
pnorm(q=85, mean=75, sd=5, lower.tail=F)
```

`## [1] 0.02275013`

```
# P(Z >= 1) where Z ~ N(0,1)
pnorm(q=1, mean=0, sd=1, lower.tail=F)
```

`## [1] 0.1586553`

### 7.2.2 Let’s learn to use the `qnorm()`

command

The r code window below will calculate a value, X, such that the probability of drawing a value less than or equal to X is the probability you specify. Then the probability density function is plotted. You can change the mean, standard deviation, and value.

Experiment with the settings of mean, standard deviation, and value.

The `qnorm()`

command has four arguments that we need to be concerned about.

`p`

which holds the value for which you wish to find a probability.`mean`

which holds the mean of the normal distribution`sd`

which holds the standard deviation of the normal distribution`lower.tail`

which is set to true for a less than calculation or false for a greater than calculation.

Here is an examples from the voice thread.

```
# Find the value of Z such that P(X <= Z) = 25% where x ~ N(75,5)
qnorm(p=0.25, mean=75, sd=5, lower.tail=T)
```

`## [1] 71.62755`

## 7.3 R code used in the VoiceThread

```
# P(X <= 70) X ~ N(75,5)
pnorm(q=70, mean=75, sd=5, lower.tail=T)
# P(X >= 85) X ~ N(75,5)
pnorm(q=85, mean=75, sd=5, lower.tail=F)
# P(Z >= 1) where Z ~ N(0,1)
pnorm(q=1, mean=0, sd=1, lower.tail=F)
# Find the value of X such that P(X <= 70) = 25% where X ~ N(75,5)
qnorm(p=0.25, mean=75, sd=5, lower.tail=T)
```

## 7.4 Now you try

Use R to complete the following activities (this is just for practice you do not need to turn anything in).

- Find the value of probability that Z is greater than 1 where Z ~ N(0,1).
- Find the value of X such that P(Z <= X) = 25% where X ~ N(75,5).