Homer White, Georgetown College

- One Numerical Variable: Graphical Tools
- Histograms
- Density Plots

- Terminology for Describing Shape
- An Imaginary Population
- Boxplots

Always remember to make sure the necessary packages are loaded:

```
require(mosaic)
require(tigerstats)
```

(Graphical Tools)

A *frequency* histogram.

- 30 people drove between 80 and 100 mph.
- One person drove between 190 and 200 mph.

A *relative frequency* histogram.

- 42% drove between 80 and 100 mph.
- 7% drove between 60 and 80 mph.

A *density* histogram.

**area**of each rectangle gives**proportion**of values in its range- total area = 1 (100%)

How this works:

- The rectangle from 80 to 100 mph has base \( 80-60=20 \).
- Height of 80-100 rectangle was about 0.021
- Proportion driving between 80 and 100 is:

\[ base \times height = 20 \times 0.021 \approx 0.42. \]

- So, about 42% drove between 80 and 100 mph.

```
histogram(~fastest,
data=m111survey,
xlab="speed (mph)",
main="Fastest Speed")
```

```
densityplot(~fastest,
data=m111survey,
xlab="speed (mph)",
main="Fastest Speed")
```

- symmetric (mirror image of itself around a central vertical line)
- skewed left (tail to the lower values)
- skewed right (to higher values)
- unimodal (one major “hump”)
- bimodal (two major “humps”)

This is often called “bell-shaped.”

```
data(imagpop)
```

Some of the variables in imagpop:

```
sex math income cappun kkardashtemp
1 female no 40900 oppose 6
2 female no 56100 oppose 1
3 female no 108800 oppose 5
4 female no 43100 oppose 3
5 male no 15500 oppose 94
6 male no 49800 oppose 77
```

Numerical Approach:

```
favstats(~kkardashtemp,
data=imagpop)
```

```
min Q1 median Q3 max mean sd n
0 7 62 93 100 50.4 41.76 10000
```

Graphical Approach:

```
densityplot(~kkardashtemp,data=imagpop,
xlab="Point Rating",
main="Kim Kardashian Temp")
```

- Center
- spread
- shape
- any unusual features

So we say something like:

- The mean rating is about 50.4, with a standard deviation of 41.76.
- The distribution is symmetric, but bimodal, with modes near 0 and 100.
- People either love her or hate her!

A Special Graphical Tool

```
ImaginaryData <- c(7.1,7.3,7.5,8.2,8.5,9.1,9.5,
9.8,9,9,9.9,10,10.5,11)
bwplot(~ImaginaryData,xlab="x",
main="Example Boxplot")
```

```
bwplot(~height,data=m111survey,
main="Height at GC",
xlab="height (inches)")
```