% 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 17\\
Simple Linear Model}

% 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 Deterministic model:
$$y = \beta_0 + \beta_1 x.$$
For example, $x$ is the speed of a car and $y$ is the distance the
car traveled in 1 hour. This is an unrealistic model because the
car can not maintain the absolute constant speed. So we introduce
a noise term $\epsilon$ in the above equation.

\item Stochastic model: let $\epsilon$ be a random noise with $\mathbb{E}
\epsilon = 0$ and ${\bf Var}\epsilon = \sigma^2$. Instead of the
deterministic model we will have $y = \beta_0 + \beta_1 x +
\epsilon$. Since $\epsilon$ is a random variable, we use $Y$
instead of $y$: $$Y = \beta_0 + \beta_1 x + \epsilon.$$ Note that
$\mathbb{E}Y = \beta_0 + \beta_1 x$ and ${\bf Var} Y = \sigma^2$.
\item Given paired data $(x_1,y_1)$, $\cdots$, $(x_n,y_n)$, we
have a linear stochastic relationship
$$Y_j = \beta_0 + \beta_1x_j + \epsilon_j,$$
where $y_j$ is the observed value of a random variable $Y_j$ and
$\epsilon_j \sim \epsilon$. Note that $\mathbb{E}Y_j = \beta_0 +
\beta_1 x_j$. Let $\hat \beta_0, \hat \beta_1$ be estimators of
$\beta_0, \beta_1$. Then the {\em predicted values} or fitted
values $\hat y_j =\hat \beta_0 + \hat \beta_1 x_j$ are estimators
of $\mathbb{E} Y_j = \beta_0 + \beta_1x_j$. The differences
between the observations $y_j$ and the predicted values $\hat y_j$ are called the {\em residuals} (errors), i.e. $$r_j = y_j - \hat
y_j = y_j - \hat \beta_0 - \hat \beta_1 x_j.$$

\item {\em Least squares estimation}. We estimate
$\beta_0$ and $\beta_1$ by minimizing the {\em sum of the squared
errors} (SSE):
$$SSE = \sum_{j=1}^n r_j^2 = \sum_{j=1}^n (y_j - \hat y_j)^2 =
\sum_{j=1}^n (y_j - \beta_0 - \beta_1 x_j)^2.$$ Then the {\em
regression line} is $y = \beta_0 + \beta_1 x$.

\end{enumerate}
\subsection*{In-class problems}
{\em Example 1.} 10 students took two midterm exams.\\
Student\hspace{0.35cm}  $\|$  01  02  03  04 05 06 07 08 09 10\\
Midterm 1$\|$ 80 75 60 90 99 60 55 85 65 70\\
Midterm 2$\|$ 70 60 70 72 95 66 60 80 70 60\\
Let's find the regression line.
\begin{verbatim}
> x<-c(80, 75, 60, 90, 99, 60, 55,
85, 65, 70)
> y<-c(70, 60, 70, 72, 95, 66, 60,
80, 70, 60)
> plot(x,y)
> rarara <-lm(y~x)
> rarara
Call: lm(formula = y ~ x)
Coefficients: (Intercept)      x
              29.4827       0.5523
> abline(rarara)

> library(Devore5)
> data(ex12.15)
> attach(ex12.15)
> ex12.15
   MoE  Strength
1  29.8      5.9
2  33.2      7.2
    ...      ...
> lm(Strength~MoE)
 Call: lm(formula = y ~ x)
 Coefficients:
 (Intercept)    x
 3.2925    0.1075
\end{verbatim}
\begin{figure}[t]
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.35]{abline.ps}
%\caption{The regression line for example 1.}
\end{figure}
%Exercise 12.15.

\subsection*{Self-study problems}
Example 12.3., 12.4., 12.6., 12.7., 12.8.\\
\end{document}
