\documentclass[30pt,landscape]{foils}

\usepackage{amsmath}

\usepackage{pause}               \usepackage{background}
\usepackage{graphicx}           \usepackage{geometry}
\usepackage{hyperref}

\usepackage{pp4slide}
\geometry{headsep=3ex,hscale=0.9}

\newtheorem{example}{Example} 
\newtheorem{question}[example]{Question}
\newtheorem{definition}[example]{Definition}
\newtheorem{theorem}[example]{Theorem}
\newtheorem{fact}[example]{Fact}
\newtheorem{notation}[example]{Notation}

\newcommand{\pz}{\pause}
\newcommand{\pb}{\pagebreak}

\definecolor{bgblue}{rgb}{0.03,0.39,0.23}
\vpagecolor{bgblue}

\hypersetup{pdftitle={lecture},
  pdfsubject={A mathematics lecture},
  pdfauthor={Dev Sinha, University of Oregon},
  pdfkeywords={pdftex, acrobat},
  pdfpagemode={FullScreen},
  linkcolor={red}
}

\begin{document}

{\Large Review of percentile calculations with normal distributions}\pz

Any data which is normally distributed (such as many ``random'' 
data such as coin tosses) can be analyzed systematically
using $z$-scores or ``standardized variables.'' \pz
In particular, one can easily associate percentiles to data
which is normally distributed. \pz
Such computations can be done automatically on some
calculators, and are aided by a table in our book. \pb

{\large Finding percentiles using $z$-scores} \pz

\begin{definition}
Given an observation $x$ among normally distributed data with
distribution $N (\mu ,\sigma)$, the $z$-score for $x$ is 
\[
\frac{x-\mu}{\sigma}.
\]  \pz
\end{definition} 

The  $z$-score measures how far from the mean one is, \pz
in terms of the standard deviation. \pz  They are convenient
for finding percentiles (what percent of data lies above or below
a given data point). \pz

If $x$ is observed in a normal distribution, then to find the percentile associated
to $x$ we:
\begin{enumerate}
\item Compute the associated $z$-score, or standardized variable. \pz
\item Look up the $z$-score in Table A, to get an associated fraction. \pz
\item Multiply by 100 to get a percentage score.
\end{enumerate} \pb

\begin{example}
Birthweight in the United States is normally
distributed according to $N (7.31, 1.26)$.  What was
the weight percentile of Prof. Sinha's daughter Kiri, born
at 6.12 pounds?\pz
\end{example}

%How does this compare with your previous estimate of this number? \pb

\begin{example} 
Scores on the (old) Math SAT I for males have mean 537, standard
deviation 116 and are normally distributed.  So our variable $x$ is $N
(537,116)$.  
What percent of men score between 550 and 650? \pb
\end{example}


{\large Finding variable ranges from percentiles.} \pz

We can also start with some idea of a percentile or proportion we want to achieve
and find where in our data matches that percentile. \pz

Suppose $x$ is a normally distributed
variable with distribution $N (\mu ,\sigma)$ and you wish to find a
value $C$ so that K\% of the observations of $x$ satisfy $x \leq C$.
Take the following steps: \pb

\begin{enumerate}
\item Find $K/100$ inside of Table A.  Take the correspondong value,
call it $U$. \pz  (This means K\% of observations of the standard normal 
variable $z$ will satisfy $z \leq U$). \pz
\item Unstandardize:  $z \leq U$ is the same as 
\[
\frac{x - \mu }{\sigma} \leq U \mbox{ or } x-\mu \leq \sigma U \mbox{
or } x \leq \sigma U + \mu. \pz
\]
So $C = \sigma U + \mu$. \pz  
As desired, K\% of data points will be less than $C$.
\end{enumerate}
\pb

\begin{example}
With Math SAT data as given above, 
what is the range of scores for the top 10\% of men? \pz
\end{example}

\begin{example}
Suppose a professor has pre-ordained that 20\% of his
class should get A's, 40\% get B's, 30\% get C's, 5\% D's
and 5 \% get F's.  \pz (Such a system of pre-ordained percentages
is called ``grading on the (bell) curve'', a standard practice at places
like MIT, but not one that Prof. Sinha is a fan of.)  \pz  Suppose the final grade averages are 
normally distributed with an mean of $72$ and a standard deviation
of $8$.  \pz  Where should the grade lines be set to achieve the percentages
of this system? \pb
\end{example}

{\Large Analyzing two variables: \pz scatterplots, correlations, and causes}\pz

\begin{quote}
{The invalid assumption that correlation implies cause is probably
among the two or three most serious and common errors of human
reasoning. }

{--Stephen Jay Gould, The Mismeasure of Man } \pz
\end{quote}
\pb

So far, we've been analyzing a data for a single variable.  We now
analyze two variables,
where things are more interesting and much harder to interpret.\pause 
As before we will develop some of the more basic tools and informal
language first through looking at a number of examples, \pz
and then (next class) introduce some numbers
which allow us to be more precise in our language.

%\foilhead{\purple{Scatterplots} }

\newpage

\begin{example}
Consider life expectancy in 40 countries for men and women.  The
life expectancy for men varies between 50 and 76.  For women it varies
between 53 and 82.\pause 

\includegraphics[height=9cm]{Figures/female-male.jpg}\pause 
\end{example}

We're interested in the relationship, country by country, between the
life expectancy of men and women in that country.  One way to
represent this is by a \emph{scatterplot},  a plot on two axes, as above. \pz

In this plot, each point represents a country.  The $x$-coordinate of
that point represents the female life expectancy in the country.  The
$y$-coordinate represents the male life expectancy in the country. \pz

The lowest left point represents Sudan, at
$(54,52)$.    The highest right point at $(82,76)$ represents
Japan.  
%(Below that is a darker point at $(82,75)$ representing
%\emph{two} countries - Italy and Spain).\pause 

Notice that these variable seem related.  They fall, more or less,
along a line. \pause   Does this mean a long life expectancy for women causes
a long life expectancy for men (or vice versa)?  \pause Or is it just
a coincidence?  \pause Or does it
mean that both of these things are caused by some third thing?\pause

Probably the last.  These variables \emph{are} related, and they are
strongly \emph{correlated}  (we can more or less predict one from the
other).  But neither one is \emph{caused} by the other. \pb 

{\large Scatterplots} \pz

\begin{definition}
A scatterplot is a graphical representation of \emph{two} quantitative variables
associated to the same set of individuals. \pz
\end{definition}

 In our previous example, the
``individuals'' are the 40 countries.  The two quantitative variables
are ``female life expectancy'' and ``male life expectancy.''\pb

Suppose we have a set of data with 6 variables:  ``country name,'' ``life
expectancy,'' ``number of people per television,'' ``number of people
per doctor,''  ``female life expectancy,'' ``male life expectancy.'' \pz
Which variables could be plotted in a scatterplot? \pz

\begin{example}
We analyze a scatterplot with ``number of people per television''
on the x-axis and ``number of people per doctor'' on the y-axis.
\end{example}

\includegraphics{Figures/tv-doctor.jpg}

%These two variables are also related, but much less neatly.  There are
%examples (North Korea at $(90, 370)$) with few TVs and lots of
%doctors.  There are others (Thailand at $(11, 4883)$) with many TVs
%and very few doctors.  \pause More noticeable is just that the wealthy
%countries are clustered in the lower left. \pause

After some analysis, we find that 
although these two variable are related, it seems unlikely that
either is a partial cause for the other.  In this case, both are at
least partially related to the \emph{wealth} of the country.  This is
called a \emph{{lurking}} variable, because it doesn't appear
directly in our scatterplot, but is responsible for a lot of the
variation. \pb 

{\large Explanatory and Response Variables}\pz

Often when comparing two variables we suspect that the variation in
one variable is partly caused by variation in the other.  We call the
variable \emph{causing} the change the \emph{{explanatory}}
variable and the variable being changed the \emph{{response}}
variable.  \pause 

\begin{example}
We compare the \% of economically disadvanted
children in elementary schools in Kalamazoo Michigan with the
\% of students at those schools passing the MEAP (Michigan Educational
Assesment Program).

So our \emph{individuals} are 14 elementary schools in Kalamazoo.
Our variables are \emph{percent of economically disadvantaged
students} and \emph{percent passing the MEAP}. \pz

What is the relationship between these variables? \pz  Is there
an explanatory variable and a response variable? \pz
\end{example}

\includegraphics{Figures/ecodis-meap.jpg}


%Notice that as the percent disadvantaged increases, the percent
%passing the MEAP drops off dramatically.  Experience suggests that the
%quality of schools is often lower in poorer neighborhoods, so it is
%reasonable here to think of the ``percent disadvantaged'' as the
%explanatory variable and the ``percent passing MEAP'' as the response
%variable. \pb 


{\large Postive association and negative association}\pz

\begin{definition}
Two variables are \emph{positively associated} if larger values in one
variable tend to accompany larger values in the other. \pz

Two variables are \emph{negatively associated} if smaller values in one
variable tend to accompany larger values in the other. \pz
\end{definition} 

\begin{example}
Let's examine our three previous examples to see if there are any associations,
and if so whether they seem weak or strong.  
%Strong positive, weaker positive, negative.
\end{example}\pause 


{\large Measuring strength of association}\pz

By looking at a scatterplot, we get a subjective impression of strength
of association.  One \emph{objective} measure is given by the
{\emph{correlation}}. \pz

Suppose we have a data set with $n$ individuals and two variables $x$
and $y$.  The correlation measures how close the \emph{linear}
relationship is between $x$ and $y$.    \pb

\begin{definition}
The correlation is usually
written $r$,  and the formula for it is
\[
r = \frac{1}{n-1}\sum_{i=1}^{n} (\frac{x_{i}-\overline{x}}{s_{x}}) (\frac{y_{i}-\overline{y}}{s_{y}}).
\]
In this formula,  $\overline{x}$ is the mean of the $x_{i}$, and
$s_{x}$ is the standard deviation of the $x_{i}$.  Similarly for the
$y$'s.
\end{definition}
\pause 

Let's not worry about how to compute this value and just
look at our three examples.
\begin{itemize}
\item We get $r=.979$ in our example comparing men's
and women's life expectancy in 40 countries.  That tells us that the
points on the scatterplot are close to a line sloping up.\pause 
\item We get $r=.620$ in our example comparing ``people per TV'' with
``people per doctor.''  This tells us that the points on the
scatterplot are roughly approximated by some line sloping up.\pause 
\item We get $r = -.735$ in our example comparing ``percent
economically disadvantaged'' with ``percent passing MEAP.'' This tells
us the points on the scatterplot are roughly approximated by a line
sloping down.\pause 
\end{itemize} 

How do these values relate to what we said about positive and
negative association above? \pb

Here are some general facts to remember about correlation.
\begin{itemize}
\item $-1 \leq r \leq 1$. \pause  
\item When $r=1$, the points on the scatterplot
lie on a line sloping up, \pz which means that the variables
are positively correlated. \pz When $r$ is near one but below,  the points
are close to being on a line sloping up.\pause 
\item   When $r=-1$, the points on the scatterplot
lie on a line sloping down, \pz which means that the variables
are negatively correlated. \pz  If $r$ close to $-1$, the points are
close to being on a line sloping down. \pause 
\item If $r$ is
close to $0$ there is a very weak relationship.\pause 
\item To measure $r$, both variables must be quantitative.  \pause 
\item $r$ tells you nothing about cause and effect,  just about
whether the two variables are related.\pause 
\item $r$ is \emph{not} resistant.  \pz It can be strongly effected by outliers.
\end{itemize}




\end{document}
 