
% This is a simple LaTex sample document that gives a submission format
%   for IEEE PAMI-TC conference submissions.  Use at your own risk.

% Make two column format for LaTex 2e.
\documentclass[11pt,twocolumn]{article} %,twocolumn
\usepackage[dvips]{graphicx,graphics}
\usepackage{times,amsmath,amsfonts}

% Use following instead for LaTex 2.09 (may need some other mods as well).
% \documentstyle[times,twocolumn]{article}

% Set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{9.9in} \setlength{\textwidth}{6.9in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.2in}  % Centers text.
\setlength{\evensidemargin}{-.2in}

% Add the period after section numbers.  Adjust spacing.
\newcommand{\Section}[1]{\vspace{-8pt}\section{\hskip -1em.~~#1}\vspace{-3pt}}
\newcommand{\SubSection}[1]{\vspace{-3pt}\subsection{\hskip -1em.~~#1}
        \vspace{-3pt}}
\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand{\diff}[1] {\frac{\partial}{\partial #1}}
\newcommand{\jacob}[3]{\frac{\partial^2 #3}{\partial #1 \partial #2}}
\newcommand{\der}[2]{\frac{\partial #2}{\partial #1}}
\begin{document}

% Don't want date printed
%\date{January 23, 2003}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat 312: Lecture 22\\
Correlation coefficient.}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
\date{Dec 9, 2004}
% For two authors (default example)
\maketitle \thispagestyle{empty}
\begin{enumerate}

\item {\em Correlation coefficient} between two random
variables $X$ and $Y$ is defined as $$\rho(X,Y) = \frac{{\bf
Cov}(X,Y)}{\sqrt{{\bf Var}(X){\bf Var}(Y)}}.$$ The {\em sample
correlation coefficient} $r$ between two samples $x_i$ and $y_j$ is
defined as $r = S_{xy}/\sqrt{S_{xx}S_{yy}}.$ {\em Example} Is there
any linear relationship between the mathematical achievement test
scores ($x_i$) and calculus grades
($y_i$) for 10 college freshmen?\\
x$\|39,43,21,64,57,47,28,75,34,52$\\
y$\|65,78,52,82,92,89,73,98,56,75$
\begin{verbatim}
x<-c(39,43,21,64,57,47,28,75,34,52)
y<-c(65,78,52,82,92,89,73,98,56,75)
> cor(x,y)
[1] 0.8397859
\end{verbatim}
We are interested in testing $H_0: \rho = 0 \mbox{ vs. } H_1: \rho
\neq 0.$ In order to do this, we need to know the distribution of
the sample correlation coefficient $r$ under the null assumption.
\item Suppose the joint probability density function $f$ of $X$ and $Y$ is the {\em
bivariate normal} such that $X \sim N(\mu_X,\sigma_X^2)$, $Y \sim
N(\mu_Y,\sigma_Y^2)$ and $\rho(X,Y)=\rho$. In this situation, it can
be shown that $$\mathbb{E}(Y|X=x) = \beta_0 + \beta_1 x,$$ where
$\beta_1 = \rho \sigma_Y/\sigma_X$. This is the regression model we
studied before. Note that $\rho =0$ if and only if $\beta_1=0$.
Hence testing $$H_0:\rho =0 \mbox{ vs. } H_1:\rho \neq 0$$ is
equivalent
 to $$H_0:\beta_1 =0 \mbox{ vs. } H_1:\beta_1 \neq 0.$$ So the appropriate test
 statistic is $$T= (\hat \beta_1-\beta_1)/S_{\hat
 \beta_1} = \beta_1/S_{\hat
 \beta_1} \sim t_{n-2}$$
under the null assumption. It can be shown that the test statistic
is equivalent to $T= \frac{r\sqrt{n-2}}{\sqrt{1-r^2}}$.

{\bf Note.} In bivariate normal data, $\rho=0$ if and only if $X$
and $Y$ are independent. So testing for independence is equivalent
to testing $\rho=0$ in this situation.


\begin{verbatim}
> summary(lm(y~x))
Call: lm(formula = y ~ x)
Coefficients:
            ...  t value Pr(>|t|)
(Intercept) ...   4.794  0.00137
...
x 0.7656 0.1750   4.375 0.00236
... Multiple R-Squared: 0.7052
...
\end{verbatim}
\item {\em Fisher $z$-transformation}. Given sample correlation $r$,
$$z = \tanh^{-1} r = \frac{1}{2}\ln(\frac{1+r}{1-r})\sim N\Big(\rho,\frac{1}{\sqrt{n-3}}\Big).$$
This is asymptotic results for large sample.

\begin{verbatim}
>fisher.z<-function(r){atanh(r)}
>cor.test(x,y,"two.sided","pearson"
          ,conf.level=0.95)
Pearson's product-moment correlation data:
x and y t=4.375, df =8, p-value = 0.002365
...
95 percent confidence interval:
 0.4459632 0.9611846
sample estimates:
      cor
0.8397859
\end{verbatim}
{\tt R}-package {\tt cor.test} with {\tt pearson} option is based on
the exact distribution of a test statistic using $t_{n-2}$
distribution.


\end{enumerate}
\end{document}
