You are on page 1of 6

%%%%%%%% PREAMBLE

\documentclass{article}

% Extra packages for graphics, header control, good math typesetting, and margin
% control:
%\usepackage{amsmath}%My default package
%\usepackage{graphicx}%needed to insert figures
\usepackage{graphicx, amsmath}%,
\usepackage[usenames]{color}%for colored text
\usepackage{hyperref}%needed for footnotes, hyperlinks, etc. (must be placed AFTER
all the other packages)
\hypersetup{colorlinks,%this will make the links the text instead of putting an
ugly box around the links
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=blue
}
\definecolor{gray}{gray}{0.95}%defining gray
\definecolor{orange}{rgb}{.7,0.5,0}%the last curly brace tells you how much of red,
green and blue
\definecolor{orange2}{cmyk}{0,0.5,1,0}%another orange

%\usepackage{multirow}
% \usepackage{pxfonts}
%\numberwithin{equation}{section}
% Lengths and margins: you're not supposed to monkey around with these in LaTeX,
% but default margins waste a lot of paper. For readability, leave lots of space
% on the left and right, but feel free to cut down blank space at the top and
% bottom of the page.

%\usepackage{amsfonts, amsmath, amsthm, graphicx}

%\usepackage{setspace}

% The amssymb package provides various useful mathematical symbols


%\usepackage{amssymb}
%\usepackage{harvard}
%\usepackage[none]{hyphenat}
%\sloppy
%\usepackage[ngerman]{babel}
%\usepackage[latin1]{inputenc}

%\geometry{ left = 1.75in, right = 1.75in, top = 1in, bottom = 1in }


%\geometry{ left = 1in, right = 1in, top = 1in, bottom = 1in } %this is for one-
inch margins instead of the normal LaTeX margins

% Headers and footers with FANCYHDR, a package which provides some useful extra
% commands. Note that "l," "r" and "c" denote "left," "right" and "center." The
% \headsep line contrals space between your header and the first bit of actual
% text on the page. The \headrulewidth line controls the thickness of the line
% under your header. Set this to 0 (by un-commenting the line below) if you
% don't want a line there.

%\newenvironment{packed_enum}{
%\begin{itemize}
%\setlength{\itemsep}{1pt}
%\setlength{\parskip}{0pt}
%\setlength{\parsep}{0pt}
%}{\end{itemize}}

%\pagestyle{fancy}
%\setlength{\headsep}{.5in}
%\renewcommand{\headrulewidth}{.25pt}

%\lhead{\footnotesize Econ 244}


%\chead{Alex, James, Teferi, Sebastian, Deza}
%\rhead{\footnotesize February 27th, 2009}

%\lfoot{}
%\cfoot{\footnotesize Page \thepage}
%\rfoot{}

% To avoid typing long expressions many times, define your own commands. (In some
% cases, LaTeX may already have definitions for the names you've chosen, in which
% case you need to re-define them -- this is the difference between %%%%\newcommand
% and \renewcommand.)

%\setstretch{1.35}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF
PREAMBLE

\begin{document}

%\begin{flushright}
%Name
%\end{flushright}
%\begin{center}
%title
%\end{center}
%BEGIN "NORMAL "WORD"" PAPER HERE:

%%%%%%%%%%%%%%%%%%%lastquestion on final%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{enumerate}
\item[4.] Urban travel times and distances are important factors in the analysis of
traffic flow
patterns. A traffic engineer in Los Angeles obtained the following data from area
freeways.
x = miles traveled and y = time in minutes to travel x miles in an automobile.\\
\begin{table}[htbp]
\caption{}
\begin{center}
\begin{tabular}{|l|r|r|r|r|r|r|r|r|}
\hline
\textbf{X} & 5 & 9 & 3 & 11 & 20 & 15 & 12 & 25 \\ \hline
\textbf{Y} & 9 & 13 & 6 & 16 & 28 & 21 & 16 & 31 \\ \hline
\end{tabular}
\end{center}
\label{}
\end{table}\\
\begin{enumerate}%%%%%%%%%%%%%%%%%%%%%part
(a.)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item(5 points) Calculate $\sum{x}, \sum{y}, \sum{x^2}, \sum{y^2}, \sum{xy},
\bar{x}, \bar{y}$ and draw the scatter diagram.\\
\textit{Comments:} so next is just the algorithm we followed in class(calc. the
above quantities, draw the scatter diagram, show that you can represent the data by
a line by making sure r $\geq$ critical value on page 600 of the book, find the
equation of $\hat{y}$, draw $\hat{y}$, given an x-value give the corresponding y-
value, use a hypothesis test to see if the <i>population</i> can be correlated by a
line, and finally, find the confindence interval of y values for a given x value
(part (g.))\\
\begin{table}[htbp]
\caption{}
\begin{center}
\begin{tabular}{cccccccccc}

& $x$ & & $y$ & & $x^{2}$ & & $y^{2}$ & & $xy$ \\
& 5 & & 9 & & 25 & & 81 & & 45 \\
& 9 & & 13 & & 81 & & 169 & & 117 \\
& 3 & & 6 & & 9 & & 36 & & 18 \\
& 11 & & 16 & & 121 & & 256 & & 176 \\
& 20 & & 28 & & 400 & & 784 & & 560 \\
& 15 & & 21 & & 225 & & 441 & & 315 \\
& 12 & & 16 & & 144 & & 256 & & 192 \\
& 25 & & 31 & & 625 & & 961 & & 775 \\
$\sum{x}$= & 100 & $\sum{y}$= & 140 & $\sum{x^{2}}$= & 1630 & $\sum{y^{2}}$= & 2984
& $\sum{xy}$= & 2198 \\
\end{tabular}
\end{center}
\label{}
\end{table}\\
$\bar{x} = \frac{\sum{x}}{n} = \frac{100}{8} = 12.5 $\\
$\bar{y} = \frac{\sum{y}}{n}= \frac{140}{8}=17.5$\\
For the scatter diagram see \hyperref[scatter]{the appendix}\\%the first bracket is
the name of the label
%I need this because otherwise the following text in the next part of the problem
comes before the graph.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%___________________________partb_________________________________
______%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item (5 points) Show analytically that you can correlate the data from this sample
by a line with $\alpha=0.05$\\
\begin{align*}%align with the star means that it won't have a number
r &= \frac{n\sum{xy}-\sum{x}\sum{y}}{\sqrt{n\sum{x^{2}}-
(\sum{x})^{2}}\sqrt{n\sum{y^{2}}-(\sum{y})^{2}}}\\
&=\frac{8(2198)-(100)(140)}{\sqrt{8(1630)-100^{2}}\sqrt{8(2984)-140^{2}}}\\
&=\frac{3584}{\sqrt{3040}\sqrt{4272}}\\
&= 0.9945
\end{align*}
Since $r=0.9945 \leq 0.71 = $\text{critical value on page}
600(\hyperref[criticalvalue]{see appendix}), we can correlate the data by a line.
\item (5 points)Find the equation of the line that best correlates the data from
the sample\\
\textit{Comments: }So for this part we also follow the algorithm for the class
(i.e., find $b$, then find $a$, then find $\hat{y}$)\\
\begin{align*}
b &=\frac{n\sum{xy} -\sum{x}\sum{y}}{n\sum{x^{2}-
(\sum{x})^{2}}}=\frac{3584}{3040}=1.18\\
a &=\bar{y}-b\bar{x}=17.5-(1.18)(12.5)=2.76\\
\hat{y} &=a + bx\\
\hat{y} &= 2.76 + 1.18x
\end{align*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%___________________________partd_________________________________
______%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item (5 points) Draw the line from part (c.) on the scatter plot.\\
\textit{Comments:} just pick two $x$'s and find the corresponding $y$-values but
plugging in the $x$-values into the $\hat{y}$ formula. For instance, I picked 5 and
25 for my $x$ values, but you can pretty much pick which ever values you'd like.\\
\begin{table}[htbp]
\caption{}
\begin{tabular}{|c|c|}
\hline
$x$ & $y$ \\ \hline
5 & 8.7 \\ \hline
25 & 32.2 \\ \hline
\end{tabular}
\label{}
\end{table}
\begin{align*}
2.76 + 1.18(5) &= 8.7\\
2.76 + 1.18(25) &= 32.2
\end{align*}
Then just plot these points on the graph\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%___________________________parte_________________________________
______%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item (5 points) Predict time in minutes to travel 31 miles on the Freeway\\
\begin{align*}
x &= 31\\
\hat{y} &= 2.76 + 1.18(31)\\
&= 39.3 minutes
\end{align*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%___________________________partf_________________________________
______%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item (15 points) Test hypothesis about the population correlation coefficient with
$\alpha = 0.05$.
\begin{itemize}
\item State the null and alternate hypothesis\\
\begin{align*}
H_{0} &: \phi = 0\\
H_{1} &; \phi > 0
\end{align*}
\item Compute sample test statistics\\
d.f. = n-2 = 8-2 = 6
\begin{align*}
t &= \frac{r\sqrt{n-2}}{\sqrt{1-r^{2}}}\\
&=\frac{.995\sqrt{8-2}}{\sqrt{1-(.995)^{2}}}\\
&= \frac{.995\sqrt{6}}{\sqrt{1-(.995)^2}}\\
&= 23.3
\end{align*}
\item Find or estimate the $P-value$.\\
\begin{align*}
5.959 &< 23.3\\
0.0005 &> P-value
\end{align*}
\item Conclude the test by rejecting or not rejecting the null hypothesis\\
So, since $\alpha = 0.05 > 0.0005 > P-value$, therefore $P-value \leq
\alpha$, so we reject $H_{0}$ and assume $H_{1}$
\item State your conclusion in the context of the application\\
We conclude that the population correlation coefficient between $x$ and $y$
is positive.
\end{itemize}
\item (10 points) find the 95 \% confidence interval for the amount of time that
you need to travel 31 miles on the Freeway.\\
\begin{center}
$c = 0.95, x = 31, \hat{y} = 39.3, d.f. = 6, t_{c} = 2.447$
\end{center}
First, calculate $S_e$:
\begin{align*}
S_{e} &= \sqrt{\frac{\sum{y^2}-a\sum{y}-b\sum{xy}}{n-2}}\\
&= \sqrt{\frac{2984-2.76(140)-1.18(2198)}{6}}\\
&= \sqrt{\frac{5.83}{6}}\\
&= .986
\end{align*}
Now, calculate $E$:
\begin{align*}
E &= t_{c}S_{e}\sqrt{1 + \frac{1}{n} + \frac{n(x - \bar(x))^{2}}{n\sum{x^{2}}-
(\sum{x})^{2}}}\\
&= 2.447(0.986)\sqrt{1 + \frac{1}{8}+ \frac{8(31 - 12.5)^{2}}{8(1630)-100^{2}}}\\
&= 2.412\sqrt{2.026}\\
&= 3.43\\
\end{align*}
So, the confidence interval becomes
\begin{align*}
\hat{y} - E < &y < \hat{y} + E\\
= 39.3 - 3.43 < &y < 39.3 + 3.43\\
= 35.9 < &y < 42.7
\end{align*}
\end{enumerate}%finish number 4
\end{enumerate}%finish the test
%\bibliography{../../bibliography/bibliography}
\newpage
\appendix
\section{Appendix}
\begin{figure}[htbp!]
\centering

\includegraphics[width=1\textwidth]{C:/Users/victor/Desktop/TeX/Juan_TeX/stat/final
/scatter.pdf}%note to make the graph good I had to copy and past the graph onto
open office draw, where the draw page is in landscape. then I had to resize it.
then I had to save the draw document. then you can export it.
\label{scatter}
\end{figure}
\begin{table}[htbp]
\begin{center}
\caption{Critical Values for the Correlation Coefficient r}
\begin{tabular}{|r|r|r|}
\hline
\multicolumn{1}{|l|}{$n$} & \multicolumn{1}{l|}{$\alpha=0.05$} &
\multicolumn{1}{l|}{$\alpha=0.01$} \\ \hline
3 & 1 & 1 \\ \hline
4 & 0.95 & 0.99 \\ \hline
5 & 0.88 & 0.96 \\ \hline
6 & 0.81 & 0.92 \\ \hline
7 & 0.75 & 0.87 \\ \hline
8 & 0.71 & 0.83 \\ \hline
9 & 0.67 & 0.8 \\ \hline
10 & 0.63 & 0.76 \\ \hline
11 & 0.6 & 0.73 \\ \hline
12 & 0.58 & 0.71 \\ \hline
13 & 0.53 & 0.68 \\ \hline
14 & 0.53 & 0.66 \\ \hline
15 & 0.51 & 0.64 \\ \hline
16 & 0.5 & 0.61 \\ \hline
17 & 0.48 & 0.61 \\ \hline
18 & 0.47 & 0.59 \\ \hline
19 & 0.46 & 0.58 \\ \hline
20 & 0.44 & 0.56 \\ \hline
21 & 0.43 & 0.55 \\ \hline
22 & 0.42 & 0.54 \\ \hline
23 & 0.41 & 0.53 \\ \hline
24 & 0.4 & 0.52 \\ \hline
25 & 0.4 & 0.51 \\ \hline
26 & 0.39 & 0.5 \\ \hline
27 & 0.38 & 0.49 \\ \hline
28 & 0.37 & 0.48 \\ \hline
29 & 0.37 & 0.47 \\ \hline
30 & 0.36 & 0.46 \\ \hline
\end{tabular}
\label{criticalvalue}
\end{center}
\end{table}
%common commands: \hyperref[scatter]{the appendix}
\end{document}

You might also like