Lecture 2
2020-07-07
Serena DeStefani – Lecture 2 – 7/7/2020
First HW due tomorrow morning before class:
Please join Datacamp
Tutor available
From the binomial expansion to the normal distribution
We can plot the frequency of getting heads on a histogram



From the binomial expansion to the normal distribution
The more coin tosses I make, the more this histogram will resemble a curve:
See simulation at: https://shiny.rit.albany.edu/stat/binomial/
How to display and describe categorical data:




How to compare categorical data:


Independence: The distribution of one variable is the same for all categories of another.
There is no association between the two.
An association that holds for all of several groups can reverse direction when the data are combined to form a single group. This reversal is called Simpson’s paradox.
Histogram: A chart that displays quantitative data
Great for seeing the distribution of the data
A histogram of tsunami generating earthquakes
Different bin widths tell different stories.


Relative Frequency Histogram

Is the variable quantitative? Is the answer to the survey question or result of the experiment a number whose units are known?
A Mode of a histogram is a hump or high-frequency bin.
Unimodal

Bimodal

Multimodal

Uniform Distribution
Symmetric

Not Symmetric

Symmetric

Skewed Right

Skewed Left

An Outlier is a data value that is far above or far below the rest of the data values.
The histogram shows the amount of money spent by a credit card company’s customers. Describe and interpret the distribution.

Median: The center of the data values
First order the numbers.
If there are an odd number of numbers, \(n\), the median is at position \(\frac{n+1}{2}\).
Find the median of the numbers: 2, 4, 5, 6, 7, 9, 9.
\[\frac{n+1}{2} = \frac{7+1}{2} = 4\]

The median is the fourth number: 6
Note that there are 3 numbers to the left of 6 and 3 to the right.
First order the numbers.
If there are an even number of numbers, \(n\), the median is the average of the two middle numbers: \(\frac{n}{2}, \frac{n}{2}+1\).
Find the median of the numbers: 2, 2, 4, 6, 7, 8.
\[\frac{n}{2} = \frac{6}{2} = 3\]
The median is the average of the third and the fourth numbers:
\[\text{Median} = \frac{4+6}{2} = 5\]
Locating the center is only part of the story
The range is the difference between the maximum and minimum values.
\[\text{Range} = \text{Maximum} - \text{Minimum}\]
Percentiles divide the data into one hundred groups.
The \(n\)th percentile is the data value such that \(n\) percent of the data lies below that value.
The Interquartile Range (IQR) is the difference between the upper quartile and the lower quartile
\[\text{IQR} = Q3 - Q1\]
The Interquartile Range for earthquake causing tsunamis is 0.9.
The picture below shows the meaning of the IQR.
The 5-Number Summary provides a numerical description of the data. It consists of
The list to the right shows the 5-Number Summary for the tsunami data.

A Boxplot is a chart that displays the 5-Point Summary and the outliers.

John Tukey

The lower fence is defined by: Lower Fence = Q1 – (1.5 × IQR)
The upper fence is defined by: Upper Fence = Q3 + (1.5 × IQR)
Tsunami Example: Q1 = 6.7, Q3 = 7.6
Question: How often are US flights cancelled?
We have a dataset with flight cancellations by month
Identify the Variable
How will the data be summarized?


How is the data skewed?
What can we say about the IQR?
Do we have an outlier?
A symmetric distribution is easier to describe
The Mean is what most people think of as the average.
Add up all the numbers and divide by the number of numbers.
\[\bar{y} = \frac{\sum y}{n}\]
Recall that \(\sum\) means “Add them all.”
If you put your finger on the mean, the histogram will balance perfectly.

For symmetric distributions, the mean and the median are equal.
The tail “pulls” the mean towards it more than it does to the median.
The mean is more sensitive to outliers than the median.
\[s^2 = \frac{\sum \left(y - \bar{y}\right)^2}{n-1}\]
The variance is a measure of how far the data is spread out from the mean.
The difference from the mean is: \(y - \bar{y}\).
To make it positive, square it.
Then find the average of all of these distances, except instead of dividing by \(n\), divide by \(n - 1\).
Use \(s^2\) to represent the variance.
The variance will mostly be used to find the standard deviation \(s\) which is the square root of the variance.
The variance’s units are the square of the original units.
Taking the square root of the variance gives the standard deviation, which will have the same units as \(y\).
The standard deviation is a number that is close to the average distances that the \(y\) values are from the mean.
If data values are close to the mean (less spread out), then the standard deviation will be small.
If data values are far from the mean (more spread out), then the standard deviation will be large.
Order the histograms below from smallest standard deviation to largest standard deviation.

A

B

C
Answer: C, A, B
Histogram, Boxplot
Center and Spread
Unusual Features
The car owner has checked the fuel efficiency each time he filled the tank of his new car. How would you describe the fuel efficiency?
Plan: Summarize the distribution of the car’s fuel efficiency.
Variable: mpg for the first 100 fill ups, Quantitative
Mechanics: show a histogram


Which to report?
Conclusion

Don’t make a histogram for categorical data.
Don’t look for shape, center, and spread for a bar chart.
Choose a bin width appropriate for the data.



Do a reality check
Sort before finding the median and percentiles.
Don’t compute numerical summaries for a categorical variable.
Don’t report too many decimal places.
Don’t round in the middle of a calculation.
For multiple modes, think about separating groups.
Beware of outliers, the mean and standard deviation are sensitive to outliers.
Are some months windier than others?
Which type of roller coaster is faster: steel or wooden?


We want to compare which of 4 different coffee cups keeps the coffee hot.
Measure the temperature 30 minutes after being poured for each of the four types. Repeat the experiment 8 times.



Check to see if there may have been an error in the data collection or data input.
Check to see if there was an extraordinary outcome.
Income Data:
Student Height:
Snowfall:
Exam Score:
Always comment on the outliers.
Timeplots display every data value on a timeline.

Lowess curve
Time plots can sometimes be used to predict future trends.
Predicting the future with a time plot does not always work.
Taking logarithm of the salaries makes histogram much easier to interpret.

Skewed Right:
Skewed Left:
In General:
Avoid inconsistent scales.
Label Clearly.
Beware of Outliers!
Choose the right tool.
Treat outliers with attention and care.
Use a timeplot to track trends over time.
Re-express or transform data for better understanding.
Chernova took the gold in the Olympics with a long jump of 6.545 m

Jessica Ennis won the 200 m run with a time of 22.83 s
Whose performance was more impressive?
The standard deviation helps us compare.
Chernova’s long jump was more than 1 standard deviation better than the mean.
Ennis’s winning time in the 200 m was more than 2 standard deviations faster than the mean.
Is there an even more precise way to calculate these?

In general, to find the distance between the value and the mean in standard deviations:
\[z = \frac{y - \bar{y}}{s}\]
This is called the z-score.
The z-score measures the distance of the value from the mean in standard deviations.
Chernova’s long jump
\[z = \frac{6.54 - 5.91}{0.56} \approx 1.1\]
Ennis’s 200 m run
\[z = \frac{22.83 - 24.48}{0.80} \approx -2.1\]

Ennis’s winning time is a little more impressive.
Judges could assign points based on standard deviations from mean and this system would have a correlation of 0.99 with the one currently used!
Mean: 82.36 kg
Maximum Healthy Weight: 74 kg
How are shape, center, and spread affected when 74 is subtracted from all values?


If the same number is subtracted or added to all data values, then:
If we multiply all data values by the same number, what happens to the position and spread?
To go from kg to lbs, multiply by 2.2.
The mean and spread are also multiplied by 2.2.
When we multiply (or divide) all the data values by a constant, all measures of position and all measures of spread are multiplied (or divided) by that same constant.
The mean and standard deviation in the men’s combined event at the Olympics were 168.93 seconds and 2.90 seconds, respectively.
If the times are measured in minutes, what will be the new mean and standard deviation?
Converting to z-scores:
\[z = \frac{y - \bar{y}}{s}\]
How high does a college-bound senior need to score on the ACT in order to make it into the top quarter of equivalent of SAT scores for a college with middle 50% between 1530 and 1850?
Plan: Want ACT score for upper quarter. Have \(\bar{y}\) and \(s\)
Variables: Both are quantitative. Units are points.
It is known that the middle 50% of SAT scores are between 1530 and 1850, \(\bar{y} = 1500\), \(s = 250\)
The top quarter starts at 1850.
Find the z-score:
\[z = \frac{1850 - 1500}{250} = 1.40\]
For the ACT, 1.40 standard deviations above the mean:
\[20.8 + 1.40(4.8) = 27.52\]
To be in the top quarter of applicants for that specific college in terms of combined SAT scores, a college-bound senior would need to have an ACT score of at least 27.52.
“All models are wrong, but some are useful.”
George Box, statistician
Bell Shaped: unimodal, symmetric
A Normal model for every mean and standard deviation.


Parameters: Numbers that help specify the model
Statistics: Numbers that summarize the data
\(N(0, 1)\) is called the standard Normal model, or the standard Normal distribution.
The Normal model should only be used if the data is approximately symmetric and unimodal.
68% of the values fall within 1 standard deviation of the mean.
95% of the values fall within 2 standard deviations of the mean.
99.7% of the values fall within 3 standard deviations of the mean.
In the 2010 winter Olympics men’s slalom, Li Lei’s time was 120.86 sec, about 1 standard deviation slower than the mean. Given the Normal model, how many of the 48 skiers were slower?

When data is provided, first make a histogram to make sure that the distribution is symmetric and unimodal.
Then sketch the Normal model.
Each part of the SAT has a mean of 500 and a standard deviation of 100. Assume the data is symmetric and unimodal. If you earned a 600 on one part of the SAT how do you stand among all others who took the SAT?
Mechanics:

Conclusion:
If the data value we are trying to find using the Normal model does not have such a nice z-score, we will use a table.
Example: Where do you stand if your SAT math score was 680? \(\mu = 500\), \(\sigma = 100\)
Note that the z-score is not an integer:
\[z = \frac{680 - 500}{100} = 1.8\]
Look for the z-score on the table: 1.8
Look for the second decimal place.
Result: 0.9641
96.4% of SAT scores are below 680.
What is the proportion of SAT scores that fall between 450 and 600? \(\mu = 500\), \(\sigma = 100\)
Plan: Probability that \(x\) is between 450 and 600 = Probability that \(x < 600\) – Probability that \(x < 450\)
Variable: We are told that the Normal model works. \(N(500, 100)\)

What is the proportion of SAT scores that fall between 450 and 600? \(\mu = 500\), \(\sigma = 100\)
\[z = \frac{600 - 500}{100} = 1 \qquad z = \frac{450 - 500}{100} = -0.5\]
Probability that \(x\) is between 450 and 600
Conclusion: The Normal model estimates that about 53.28% of SAT scores fall between 450 and 600.
Suppose a college admits only people with SAT scores in the top 10%. How high a score does it take to be eligible? \(\mu = 500\), \(\sigma = 100\)
Plan: We are given the probability and want to go backwards to find \(x\).
Variable: \(N(500, 100)\)

Suppose a college admits only people with SAT scores in the top 10%. How high a score does it take to be eligible? \(\mu = 500\), \(\sigma = 100\)
\(z = 1.29\)
\[\frac{x - 500}{100} = 1.29\]
\[x = 1.29 \times 100 + 500 = 629\]

Conclusion: Because the school wants the SAT Verbal scores in the top 10%, the cutoff is 629.
Based on experience, a manufacturer makes cereal boxes that fit the Normal model with mean 16.3 ounces and standard deviation 0.2 ounces, but the label reads 16.0 ounces. What fraction will be underweight?

What fraction of the cereal boxes will be underweight (less than 16.0)? \(\mu = 16.3\), \(\sigma = 0.2\)
\[z = \frac{16.0 - 16.3}{0.2} = -1.5\]
Probability \(x < 16.0\) = 0.0668
Conclusion: I estimate that approximately 6.7% of the boxes will contain less than 16.0 ounces of cereal.
Lawyers say that 6.7% is too high and recommend that at most 4% be underweight. What should they set the mean at? \(\sigma = 0.2\)
Mechanics: Sketch a picture.
\(z = -1.75\)
Find \(16 + 1.75(0.2) = 16.35\) ounces

Conclusion: The company must set the machine to average 16.35 ounces per box.
The CEO vetoes that plan and sticks with a mean of 16.2 ounces and 4% weighing under 16.0 ounces. She demands a machine with a lower standard deviation. What standard deviation must the machine achieve?
What standard deviation must the machine achieve? \(N(16.2, ?)\)
From before, \(z = -1.75\)
\[-1.75 = \frac{16.0 - 16.2}{\sigma}\]
\[1.75\sigma = 0.2, \quad \sigma = 0.114\]
Conclusion: The company must get the machine to box cereal with a standard deviation of no more than 0.114 ounces. The machine must be more consistent.
A histogram will work, but there is an alternative method.
Instead use a Normal Probability Plot.
The Normal probability plot is nearly straight, so the Normal model applies. Note that the histogram is unimodal and somewhat symmetric.
The Normal probability plot is not straight, so the Normal model does not apply. Note that the histogram is skewed right.
Don’t use the Normal model when the distribution is not unimodal and symmetric.
Don’t use the mean and standard deviation when outliers are present.
Don’t round your results in the middle of the calculation.
Don’t worry about minor differences in results.
Quantitative Methods in Psychology