% 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[10pt,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 20\\
Inference on Intercept}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
%\date{Feb 20, 2003}
% For two authors (default example)
\maketitle \thispagestyle{empty}
\subsection*{Concepts}
\begin{enumerate}
\item Least-squares estimator $\hat \beta_0 = \bar Y - \hat \beta_1 \bar x$
is distributed as normal with mean $\beta_0$ and variance
$\sigma^2\overline{x^2}/S_{xx}$.
\item Testing $H_0: \beta_0=0$ is based on
$T=\frac{\hat \beta_0 - \beta_0}{S_{\hat \beta_0}} \sim t_{n-2}$, where
$S_{\hat \beta_0} = \sigma^2\overline{x^2}/S_{xx}$.

\item {\em Coefficient of determination} measures the proportion of variability
explained by the fitted model and it is defined as
$$r^2 = 1 - \frac{SSE}{SST}$$
\item Since $SST = S_{yy}$ and $SSE = S_{yy}-S_{xy}^2/S_{xx}$, we can
see that $r^2 = S_{xy}^2/(S_{xx}S_{yy}).$ $r$ is called the {\em
sample correlation coefficient} and it will be studied in Lecture
21.
\end{enumerate}
\subsection*{In-class problems}
{\em Example 1.} Hooke's law states that the length change $y$ in
spring is proportional to applied force $x$, i.e. $y = \beta_1 x$\\
\begin{tabular}{|c|cccccc|}
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\hline
x (kg) & 29.4 & 39.2 & 49.0 & 58.8& 68.6 & 78.4 \\
\hline
 y (mm) & 4.25 & 5.25  & 6.50  & 7.85 & 8.75 & 10.10  \\
\hline
\end{tabular}\\

Fit the model $Y=\beta_0 + \beta_1 x + \epsilon$ and see if
$\beta_0$ is in fact 0.
\begin{verbatim}
> ra<-cov(y,y)/cov(x,x)-
(cov(x,y)/cov(x,x))^2
> S0<-sqrt(mean(x^2)/4*ra)
> b0<-mean(y)-mean(x)*cov(x,y)/cov(x,x)
> b0/S0
[1] 4.013
> 2*pt(-4.013,4)
[1] 0.016
>x<-c(29.4,39.2,49.0,58.8,68.6,78.4)
>y<-c(4.25,5.25,6.50,7.85,8.75,10.10)
>summary(lm(y~x))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
 (Intercept) 0.66 0.16 4.00 0.016
 x 0.12 0.003 41.24 2.07e-06
Multiple R-Squared: 0.9977
\end{verbatim}
\begin{figure}[t]
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.29]{Hookes.ps}
\caption{Hooke's law.}
\end{figure}
{\em Example 2.} Suppose that data $(x_j,y_j)$ satisfy a circular
relationship $Y_j = \sqrt{10^2 - x_j^2} + \epsilon_j.$ This is a
nonlinear relationship so we expect not to have a good linear fit.
\begin{verbatim}
>x<--10:10
>y<-sqrt(10^2 -x^2)
>summary(lm(y~x))
 Coefficients: value Pr(>|t|)
(Intercept) .... 1.24e-09
 x .... 4.47e-17
Multiple R-Squared: 1.378e-030
\end{verbatim}
\begin{figure}%[t]
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.29]{circle.ps}
\caption{Complete lack of linear fit.}
\end{figure}
\subsection*{Self-study problems}
Construct $100(1-\alpha)\%$ confidence intervals for both $\beta_0$ and $\beta_1$. Show ${\bf Var}(\hat \beta_0) = \sigma^2\overline{x^2}/S_{xx}$. Example 12.9.\\
\end{document}
