# load libraries
library(tidyverse)Lab 3: Normal Distributions and Z-Scores in R
Setup Instructions
- Download
lab3.qmdfrom bCourse under “labs” > “Lab #3” - Place
lab3.qmdin yourlabsfolder. Your folder structure should now look like this:
soc106/
├── _quarto.yml
├── data/
│ └── attain.csv
├── assignments/
│ └── hw1.qmd
│ └── hw2.qmd
│ └── hw3.qmd
│ └── hw4.qmd
│ └── hw5.qmd
└── labs/
├── lab1.qmd
├── lab2.qmd
└── lab3.qmd
- Use the
Explorerbutton on the left to find and openlab3.qmd - Let’s work through it together!
Load Libraries
Function Quick Guide
| Type of question | R function |
|---|---|
| Cumulative probability P(X ≤ x) | pnorm(x, mean = mu, sd = sigma) |
| Probability above P(X > x) | 1 - pnorm(x, mean = mu, sd = sigma) |
| Probability between P(a < X < b) | pnorm(b, mean, sd) - pnorm(a, mean, sd) |
| Percentile cutoff | qnorm(q, mean = mu, sd = sigma) |
| Standardize a value | (x - mu) / sigma |
Question 1: Normal Model and Z-Scores (Vehicle Speeds)
Assume speeds are approximately normal with mean 71 mph and standard deviation 8 mph.
- Compute the z-score for 65 mph and 80 mph.
- Compute
P(speed <= 65). - Compute
P(speed > 80). - Find the speed cutoff where only 10% of vehicles are faster.
# Your code hereQuestion 2: Z-Score Practice (Heights)
Assume adult heights are approximately normal with mean 69 inches and standard deviation 3 inches.
- Compute the z-score for a person who is 75 inches tall.
- Use
pnorm()to estimate the percentile for 75 inches. - Find the 95th percentile height using
qnorm(). - In one sentence: based on your results, is 75 inches above the 95th percentile?
# Your code hereQuestion 3: Probabilities Above and Between
Suppose SAT math scores are approximately normal with mean 520 and standard deviation 80.
- Use
pnorm()to find the proportion of students who score above 640. - Use
pnorm()to find the proportion who score between 440 and 640.
# Your code hereWrap-Up
In this lab, you practiced:
- Computing and interpreting z-scores
- Using
pnorm()to find cumulative normal probabilities - Using
1 - pnorm()to find probabilities above a threshold - Using differences of
pnorm()to find probabilities between two values - Using
qnorm()to find percentile cutoffs
TipBefore You Leave