\documentclass[12pt]{article}
\usepackage{fancyhdr}
\usepackage{color}
\usepackage{multicol}
\usepackage{fancyvrb}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{sectsty}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{array}
\newcommand{\sectionbreak}{\clearpage}

\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}

\allsectionsfont{\centering}

%\usepackage{draftwatermark}
%	\SetWatermarkText{\copyright wolf-math.com}
%	\SetWatermarkScale{4}
%	\SetWatermarkLightness{.9}

\usepackage[margin=1in, headsep=0pt]{geometry}
\setlength{\parindent}{0cm}
\pagestyle{empty}

\begin{document}

Mr. Wolf  \\ wolf-math.com

\section*{Right Triangle Trigonometry}

\subsection*{Goals}

\textbf{I will be able to} set up the 6 trigonometric ratios given a specified angle and legs.\\

\textbf{I will be able to} know the trigonometric values of special triangles.\\

\textbf{I will be able to} calculate the values of unknown sides of a triangle using trigonometric ratios of special angles.\\

\textbf{I will be able to} calculate the values of unknown sides of any right triangle using a calculator.\\

\textbf{I will be able to} calculate unknown angles of a right triangle using \textit{inverse} trig functions.

\subsection*{Standards}

\textbf{Similarity, Right Triangles, and Trigonometry \hfill G-SRT}

Define trigonometric ratios and solve problems involving right triangles.\\

6. Understand that by similarity, side ratios in right triangles are properties of the angles in the triangle, leading to definitions of trigonometric ratios for acute angles.\\

7. Explain and use the relationship between the sine and cosine of complementary angles.\\

8. Use trigonometric ratios and the Pythagorean Theorem to solve right.\\

\subsection*{Connections}

\textbf{Before} we learned the Pythagorean Theorem, the equation of a circle, the distance formula, and about the angles in a triangle all in preparation for right triangle trigonometry.\\

\textbf{After} we will apply what we know about right triangle trigonometry to trigonometry of any triangle, and from there to the unit circle.\\

\let\stdsection\section
\renewcommand\section{\newpage\stdsection}

\section*{Basic Trig Ratios} %Students have trouble figureing out the hyp vs. opp. vs. adj.

\subsection*{SOH - CAH - TOA}

\begin{center}
\begin{tikzpicture}[scale=.4]

	\coordinate (a) at (0,0);
	\coordinate (b) at (10,0);
	\coordinate (c) at (10,7);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzMarkRightAngle[size=1](a,b,c)
%	\tkzMarkAngle(c,a,b)  Angle too big!? I don't understand the problem.
	\tkzLabelAngle[pos=2](b,a,c){$\theta$}

\end{tikzpicture}
\end{center}

\begin{multicols}{2}

	$\sin(\theta) = \frac{opp}{hyp}$\\

		\vspace{1cm}

	$\cos(\theta) = \frac{adj}{hyp}$\\

		\vspace{1cm}

	$\tan(\theta) = \frac{opp}{adj}$\\

		\vspace{1cm}

	$\csc(\theta) = \frac{1}{\sin(\theta)}= \frac{\hspace{1cm}}{}$\\

		\vspace{1cm}

	$\sec(\theta) = \frac{1}{\cos(\theta)}= \frac{\hspace{1cm}}{}$\\

		\vspace{1cm}

	$\cot(\theta) = \frac{1}{\tan(\theta)}= \frac{\hspace{1cm}}{}$\\

		\vspace{1cm}

\end{multicols}

\hrulefill

\begin{center}
\begin{tikzpicture}[scale=.6]

	\draw[line width=3pt] (0,0) -- (0,5) -- (12,0) -- cycle;
	\draw[line width=2pt] (0,1) -- (1,1) -- (1,0);
	\draw (6,-1) node{12};
	\draw (-1,2.5) node{5};
	\draw (.5,4) node{$\theta$};
\end{tikzpicture}
\end{center}

Using the Pythagorean Theorem: Hyp=\underline{\hspace{1in}}\\

\begin{multicols}{2}

	$\sin(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{1cm}

	$\cos(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{1cm}

	$\tan(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{1cm}

	$\csc(\theta) = \frac{\hspace{1cm}}{}$\\

		\vspace{1cm}

	$\sec(\theta) = \frac{\hspace{1cm}}{}$\\

		\vspace{1cm}

	$\cot(\theta) = \frac{\hspace{1cm}}{•}$\\

		\vspace{1cm}

\end{multicols}

\subsection*{What is a Trig Ratio?} %You may want to think about doing this section first.

\textbf{**The whole point of trig is the ratios of the sides of right triangles**} And as long as the triangles are proportional, the ratios will always be the same.

\begin{center}
\begin{tikzpicture}[scale=.6]

	\coordinate (a) at (0,0);
	\coordinate (b) at (4,0);
	\coordinate (c) at (4,3);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle(c,a,b){$\theta$}
	\tkzLabelSegment[below=2pt](a,b){$4$}
	\tkzLabelSegment[right=2pt](b,c){$3$}
	\tkzLabelSegment[above left = 2pt](c,a){$5$}

	\coordinate (d) at (6,0);
	\coordinate (e) at (14,0);
	\coordinate (f) at (14,6);
	\draw[line width = 2pt](d) -- (e) -- (f) --cycle;
	\tkzMarkRightAngle[size=.5](d,e,f)
	\tkzLabelAngle(f,d,e){$\theta$}
	\tkzLabelSegment[below = 2pt](d,e){$8$}
	\tkzLabelSegment[right = 2pt](e,f){$6$}
	\tkzLabelSegment[above left = 2pt](f,d){$10$}

\end{tikzpicture}
\end{center}

The two triangles above are similar. That means that the larger one is the same exact shape, but each side is twice as large.

\begin{center}
{\renewcommand{\arraystretch}{2}
\begin{tabular}{c | c}

Small triangle & Big triangle\\ \hline

$\sin(\theta)=\frac{3}{5}$ & $\sin(\theta)=\frac{6}{10}= \hspace{1.5cm}$ \\

$\cos(\theta)=\frac{4}{5}$ & $\cos(\theta)=\frac{8}{10}=\hspace{1.5cm}$\\

$\tan(\theta)=\frac{3}{4}$ & $\tan(\theta)=\frac{6}{8}=\hspace{1.5cm}$

\end{tabular}} \quad
\end{center}

\vspace{.5cm}

Since the lengths of the sides are proportional (multiplied by 2), the trig ratios are the same. \\

\begin{center}
\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (3,0);
	\coordinate (t) at (3,1.1);
	\draw[line width = 2pt](r) -- (s) -- (t) -- cycle;
	\tkzMarkRightAngle[size = .5](r,s,t)
	\tkzMarkAngle(s,r,t)
	\tkzLabelAngle[pos=1.5](t,r,s){$20^\circ$}
	\tkzLabelSegment[below = 2pt](r,s){$x$}
	\tkzLabelSegment[right = 2pt](s,t){$y$}
	\tkzLabelSegment[above left = 2pt](t,r){$z$}

	\coordinate (l) at (4,0);
	\coordinate (m) at (10,0);
	\coordinate (n) at (10,2.2);
	\draw[line width = 2pt](l) -- (m) -- (n) -- cycle;
	\tkzMarkRightAngle[size=.5](l,m,n)
	\tkzMarkAngle(m,l,n)
	\tkzLabelAngle[pos=1.5](n,l,m){$20^\circ$}
	\tkzLabelSegment[below = 2pt](l,m){$2x$}
	\tkzLabelSegment[right = 2pt](m,n){$2y$}
	\tkzLabelSegment[above left = 2pt](n,l){$2z$}

\end{tikzpicture}
\end{center}

\begin{center}
{\renewcommand{\arraystretch}{2}
\begin{tabular}{c | c}

Small triangle & Big triangle\\ \hline

$\sin(20^\circ)=\frac{y}{z}$ & $\sin(20^\circ)=\frac{2y}{2z}= \hspace{1.5cm}$ \\

$\cos(20^\circ)=\frac{x}{z}$ & $\cos(20^\circ)=\frac{2x}{2z}=\hspace{1.5cm}$\\

$\tan(20^\circ)=\frac{y}{x}$ & $\tan(20^\circ)=\frac{2y}{2x}=\hspace{1.5cm}$

\end{tabular}} \quad
\end{center}

\pagebreak

\textbf{You Try} Set up the six Trigonometric ratios for the triangle below.\\

\begin{center}
\begin{tikzpicture}[scale=2]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.732,0);
	\coordinate (c) at (1.732,1);
	\draw[line width = 2pt](a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle(a,b,c)
	\tkzLabelAngle[pos=.5](c,a,b){$\theta$}
	\tkzLabelSegment[below = 2pt](a,b){$a$}
	\tkzLabelSegment[right = 2pt](b,c){$1$}
	\tkzLabelSegment[above left = 2pt](c,a){$2$}

\end{tikzpicture}
\end{center}

Using the Pythagorean Theorem: $a$=\underline{\hspace{1in}}\\

\vspace{1cm}

\begin{multicols}{2}

	$\sin(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\cos(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\tan(\theta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\csc(\theta) = \frac{\hspace{1cm}}{}$\\

		\vspace{.6cm}

	$\sec(\theta) = \frac{\hspace{1cm}}{}$\\

		\vspace{.6cm}

	$\cot(\theta) = \frac{\hspace{1cm}}{•}$\\

		\vspace{.6cm}

\end{multicols}

\hrulefill

\begin{center}
\begin{tikzpicture}[scale=.4]

	\draw[line width=3pt] (0,0) -- (0,-8) -- (15,0) -- cycle;
	\draw[line width=2pt] (0,-1) -- (1,-1) -- (1,0);
	\draw (-.5,-4) node{8};
	\draw (7.5,.5) node{15};
	\draw (7.8,-5) node{c};
	\draw (.7,-7) node{$\alpha$};
	\draw (13,-.6) node{$\beta$};

\end{tikzpicture}

$c$=\underline{\hspace{1in}}\\

\end{center}

\vspace{1cm}

\begin{multicols}{2}

	$\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

		\vspace{.6cm}

	$\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}

\section*{Special Triangles \& Their Special Angles}

There are two special triangles. These triangles are special because their angles are used to often. $30-60-90$, and $45-45-90$.\\

\begin{center}
\begin{tikzpicture}[scale=3]

	\coordinate(a) at (0,0);
	\coordinate(b) at (1.732,0);
	\coordinate(c) at (1.732,1);
	\draw[line width = 2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle(a,b,c)
	\tkzLabelAngle[pos=.4](c,a,b){$30^\circ$}
	\tkzLabelAngle[pos=.3](b,c,a){$60^\circ$}
	\tkzLabelSegment[below = 2pt](a,b){$\sqrt{3}$}
	\tkzLabelSegment[right = 2pt](b,c){$1$}
	\tkzLabelSegment[above left = 2pt](c,a){$2$}

	\coordinate (d) at (3,0);
	\coordinate (e) at (4,0);
	\coordinate (f) at (4,1);
	\draw[line width =2pt] (d) -- (e) -- (f) --cycle;
	\tkzMarkRightAngle(d,e,f)
	\tkzLabelAngle[pos=.3](f,d,e){$45^\circ$}
	\tkzLabelAngle[pos=.3](e,f,d){$45^\circ$}
	\tkzLabelSegment[below = 2pt](d,e){$1$}
	\tkzLabelSegment[right = 2pt](e,f){$1$}
	\tkzLabelSegment[above left = 2pt](f,d){$\sqrt{2}$}
\end{tikzpicture}

 \vspace{1cm}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{ l | c | c | c }

$\theta$ & $\sin(\theta)$  & $\cos(\theta)$ & \hspace{.3in}$\tan(\theta)$ \hspace{.3in} \\ \hline
$30^{\circ}$ & \hspace{1in} & &\\ \hline
$45^{\circ}$ & & \hspace{1in} &\\ \hline
$60^{\circ}$ & & &  $\sqrt{3}$ \\

\end{tabular}} \quad

\vspace{1in}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{ l | c | c | c }

$\theta$ & $\csc(\theta)$  & $\sec(\theta)$ & \hspace{.3in}$\cot(\theta)$ \hspace{.3in} \\ \hline
$30^{\circ}$ & \hspace{1in} & &\\ \hline
$45^{\circ}$ & & \hspace{1in} &\\ \hline
$60^{\circ}$ & & & $\dfrac{1}{\sqrt{3}}=\dfrac{\sqrt{3}}{3}$ \\

\end{tabular}} \quad
\end{center}

\section*{How did we get those numbers?}

A $45-45-90$ is simply a square cut along its diagonal. If each side of the square was 1, then we'd use the Pythagorean Theorem to calculate the diagonal $d$.

\begin{align*}
1^2+1^2&=d^2\\
2&=d^2\\
d&=\sqrt{2}
\end{align*}

\begin{center}
\begin{tikzpicture}

	\coordinate (w) at (0,0);
	\coordinate (x) at (3,0);
	\coordinate (y) at (3,3);
	\coordinate (z) at (0,3);

	\draw[line width=3pt] (w) -- (x) -- (y) -- (z) -- cycle;
	\draw[line width=2pt] (w) -- (y);

	\tkzMarkRightAngle[size=.5](w,x,y)
	\tkzMarkRightAngle[size=.5](w,z,y)
	\tkzLabelAngle (x,w,y){$45^{\circ}$}
	\draw (2.6,2.1) node{$45^{\circ}$};

	\tkzLabelSegment[below = 2pt](w,x){$1$}
	\tkzLabelSegment[right =2pt](x,y){$1$}
	\tkzLabelSegment[above left = .5pt](w,y){$\sqrt{2}$}

\end{tikzpicture}
\end{center}

A $30-60-90$ triangle is an equilateral triangle, with side lengths of $2$, cut by an altitude (segment from one angle, perpendicular to the opposite side). Again, two sides of the right triangle are known, so we apply the Pythagorean Theorem.\\

\begin{align*}
	1^2+&b^2=2^2\\
	1 + &b^2=4\\
	&b^2=3\\
	&b=\sqrt{3}
\end{align*}

\begin{center}
\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (4,0);
	\coordinate (c) at (2,3.464101615);
	\coordinate (d) at (2,0);

	\draw[line width=3pt] (a) -- (b) -- (c) -- cycle;
	\draw[line width=2pt] (c) -- (d);

	\tkzMarkRightAngle[size=.5,linewidth=2pt](c,d,a)
	\tkzLabelAngle[pos=.75](d,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1.3](d,c,a){$30^{\circ}$}
	\tkzLabelSegment[below = 2pt](a,d){$1$}
	\tkzLabelSegment[above left = 2pt](a,c){$2$}
	\tkzLabelSegment[right = .5pt](c,d){$\sqrt{3}$}

\end{tikzpicture}
\end{center}

 \section*{Values of Unknown Sides}

Since the trigonometric value of any two congruent angles are always the same (see above "What is a Trig Ratio"), that ratio can be used to help solve for unknown sides of the triangle.\\

Let's look at one of our special triangles first.\\

\begin{center}
\begin{tikzpicture}[scale=2]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=3pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){8}
	\tkzLabelSegment[above right=2pt](b,c){$x$}

	\tkzMarkRightAngle[linewidth=2pt](a,b,c)
	\tkzLabelAngle[pos = 0.5](b,a,c){$60^{\circ}$}
		%\tkzMarkAngle(c,a,b)
	%\tkzLabelAngle[pos=0.6](b,c,a){$30^{\circ}$}

\end{tikzpicture}
\end{center}

There are 3 questions to answer to solving for an unknown side\\

\begin{enumerate}

	\item Which side are you solving for?

	\item Which angle are you going to use?

	\item Which trig function (proportion) to use?\\

\end{enumerate}

\textbf{Use $\sin(60^\circ)$}

\[
\begin{array}{c c c c l}
				&\sin(60^{\circ})	&		= & 	\frac{\sqrt{3}}{2}  & \hspace{1cm}\text{from the special triangle} \vspace{1cm} \\
				&\sin(60^{\circ})	&		= & 	\frac{x}{8}  	& \hspace{1cm}  \text{from the triangle in front of us}\vspace{1cm} \\

	\Rightarrow &\frac{\sqrt{3}}{2}	&		= &		\frac{x}{8} 		& \hspace{1cm} \text{set equal to each other -- solve proportion} \\
\end{array}
\]

\vspace{.5in}

\textbf{Or $\cos(30^\circ)$}

\[
\begin{array}{c c c c l}
				&\cos(30^{\circ})	&		= & 	\frac{\sqrt{3}}{2}  & \hspace{1cm}\text{from the special triangle} \vspace{1cm} \\

				&\cos(30^{\circ})	&		= & 	\frac{x}{8}  	& \hspace{1cm} \text{from the triangle in front of us}\vspace{1cm} \\

	\Rightarrow &\frac{\sqrt{3}}{2}	&		= &		\frac{x}{8} 		& \hspace{1cm} \text{set equal to each other -- solve proportion} \\
\end{array}
\]

\pagebreak

\textbf{Example 2:} Solve for $a$ using a trig ratio.\\

\begin{center}
\begin{tikzpicture}

	\coordinate (x) at (0,0);
	\coordinate (y) at (3,0);
	\coordinate (z) at (3,3);
	\draw[line width=2pt] (x) -- (y) -- (z) --cycle;

	\tkzLabelSegment[below=2pt](x,y){3}
	\tkzLabelSegment[above left=2pt](z,x){$a$}

	\tkzMarkRightAngle[size=.5](x,y,z)
	\tkzLabelAngle[pos=.7](y,x,z){$45^{\circ}$}

\end{tikzpicture}
\end{center}

\begin{enumerate}

	\item Which side are you solving for?

	\item Which angle are you going to use?

	\item Which trig function are you going to use?

\end{enumerate}

\vspace{2in}

\hrulefill

\textbf{You Try:} Solve for $k$ using a trig ratio.\\

\begin{center}
\begin{tikzpicture}[scale=.8]

	\coordinate (d) at (0,0);
	\coordinate (e) at (10,0);
	\coordinate (f) at (2.5,-4.3301);

	\draw[line width=2pt] (d) -- (e) -- (f) -- cycle;

	\tkzLabelSegment[below left=2pt](d,f){5}
	\tkzLabelSegment[below right=2pt](e,f){$k$}
	\tkzLabelSegment[above = 2pt](d,e){$h$}

	\tkzMarkRightAngle[size=.7](e,f,d)
	\tkzMarkAngle[size=1](f,d,e)
	\tkzLabelAngle[pos=1.5](e,d,f){$60^{\circ}$}

\end{tikzpicture}
\end{center}

\section*{Tips and Tricks}

\subsection*{45-45-90}

\begin{center}
\begin{tikzpicture}[scale=.75]

	\coordinate (a) at (0,0);
	\coordinate (b) at (5,0);
	\coordinate (c) at (5,5);

	\draw[line width = 2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below = 2pt](a,b){$leg=n$}
	\tkzLabelSegment[right = 2pt](b,c){$leg=n$}
	\tkzLabelSegment[above left = 2pt](a,c){$hyp=n\sqrt{2}$}

	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos=1.5](b,a,c){$45^{\circ}$}
	\tkzMarkAngle(b,a,c)

\end{tikzpicture}
\end{center}

\vspace{12pt}

\begin{multicols}{2}

\begin{center}
{\renewcommand{\arraystretch}{2}
\begin{tabular}{r | c | c | c}

	angle & $45^{\circ}$ & $45^{\circ}$ & $90^{\circ}$\\ \hline
	Opposite side & $n$ & $n$ & $n\sqrt{2}$

\end{tabular}}\quad

%\vspace{12pt}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{r | c | c | c}

	angle & $90^{\circ}$ & $45^{\circ}$ & $45^{\circ}$\\ \hline
	Opposite side & $c$ & $\frac{c\sqrt{2}}{2}$ & $\frac{c\sqrt{2}}{2}$

\end{tabular}}\quad

\end{center}

\end{multicols}

\hrulefill

\subsection*{30-60-90}

\begin{center}
\begin{tikzpicture}

	\coordinate (d) at (0,0);
	\coordinate (e) at (5.196,0);
	\coordinate (f) at (5.196,3);

	\draw[line width = 2pt] (d) -- (e) -- (f) -- cycle;

	\tkzMarkRightAngle[size=.5](d,e,f)
	\tkzMarkAngle(e,d,f)
	\tkzLabelAngle[pos=1.5](e,d,f){$30^{\circ}$}
	\tkzMarkAngle(d,f,e)
	\tkzLabelAngle[pos=1.3](d,f,e){$60^\circ$}

	\tkzLabelSegment[below = 2pt](d,e){$long = n\sqrt{3}$}
	\tkzLabelSegment[right = 2pt](e,f){$short=n$}
	\tkzLabelSegment[above left = 2pt](f,d){$hyp=2n$}

\end{tikzpicture}
\end{center}

\vspace{12pt}

\begin{multicols}{2}

\begin{center}
{\renewcommand{\arraystretch}{2}
\begin{tabular}{r | c | c | c}

	angle & $30^{\circ}$ & $60^{\circ}$ & $90^{\circ}$\\ \hline
	Opposite side & $n$ & $n\sqrt{3}$ & $2n$

\end{tabular}}\quad

%\vspace{12pt}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{r | c | c | c}

	angle & $90^{\circ}$ & $30^{\circ}$ & $60^{\circ}$\\ \hline
	Opposite side & $c$ & $\frac{c}{2}$ & $\frac{c\sqrt{3}}{2}$

\end{tabular}}\quad
\end{center}

\end{multicols}

\vspace{12pt}

\begin{center}
{\renewcommand{\arraystretch}{2}
\begin{tabular}{r | c | c | c}

	angle & $60^{\circ}$ & $30^{\circ}$ & $90^{\circ}$\\ \hline
	Opposite side & $b$ & $\frac{b\sqrt{3}}{3}$ & $\frac{2b\sqrt{3}}{3}$

\end{tabular}}\quad

\end{center}

\section*{Right Triangle Trigonometry Quiz Review}

\vspace{12pt}

 \hfill NAME:\underline{\hspace{3in}}\\

 \hfill DATE:\underline{\hspace{2in}}\\

\subsection*{SOH-CAH-TOA}

\textbf{Directions:} Find the trigonometric ratios of the triangle below. Keep track of which angle is which. Reduce your fractions to lowest terms.\\

$$a^2+b^2=c^2$$

$$\sin(\theta)=\dfrac{opp}{hyp} \hspace{1cm} \cos(\theta)=\dfrac{adj}{hyp} \hspace*{1cm} \tan(\theta)=\dfrac{opp}{adj}$$\\

\begin{center}
\begin{tikzpicture}[scale=1]

	\coordinate (p) at (0,0);
	\coordinate (q) at (8,0);
	\coordinate (r) at (8,4);
	\draw[line width=3pt] (p) -- (q) -- (r) -- cycle;
	\tkzMarkRightAngle[size=.5](p,q,r)
	\tkzMarkAngle(q,p,r)
	\tkzLabelAngle[pos=1.3](q,p,r){$\alpha$}
	\tkzMarkAngle(p,r,q)
	\tkzLabelAngle[pos=1.3](q,r,p){$\beta$}
	\tkzLabelSegment[below=2pt](p,q){$8$}
	\tkzLabelSegment[right=2pt](q,r){$4$}
	\tkzLabelSegment[above left = 2pt](r,p){$C$}

\end{tikzpicture}
\end{center}

\begin{enumerate}

	\item $C=\underline{\hspace{1cm}}$\\

\begin{multicols}{2}
		\setlength\itemsep{1cm}

	\item $\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}
\end{enumerate}

\pagebreak

\subsection*{Special Triangles}

\begin{enumerate}[resume]
	\item Fill in the missing parts of the special triangles and the chart.(1 pt each)\\
\end{enumerate}

\begin{center}
\begin{tikzpicture}[scale=2.5]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.732,0);
	\coordinate (c) at (1.732,1);

	\coordinate (d) at (3,0);
	\coordinate (e) at (4,0);
	\coordinate (f) at (4,1);

	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle (a,b,c)
	\tkzLabelSegment[right=2pt](b,c){1}
	\tkzLabelSegment[below=15pt](a,b){$\underline{\hspace{1cm}}$}
	\tkzLabelSegment[above left=2pt](c,a){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.5](c,a,b){$\underline{\hspace{1cm}}^{\circ}$}
	\tkzLabelAngle[pos=.3](a,c,b){$60^{\circ}$}

	\draw[line width=2pt] (d) -- (e) -- (f) --cycle;
	\tkzMarkRightAngle(d,e,f)
	\tkzLabelSegment[below=15pt](d,e){\underline{\hspace{1cm}}}
	\tkzLabelSegment[right=2pt](e,f){1}
	\tkzLabelSegment[above left=2pt](f,d){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.3](f,d,e){$45^{\circ}$}
	\tkzLabelAngle[pos=.4](e,f,d){$\underline{\hspace{.7cm}}^{\circ}$}

\end{tikzpicture}

 \vspace{1cm}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{ l | c | c | c }

$\theta$ & $\sin(\theta)$  & $\cos(\theta)$ & \hspace{.3in}$\tan(\theta)$ \hspace{.3in} \\ \hline
$30^{\circ}$ & \hspace{1in} & &\\ \hline
$45^{\circ}$ & & \hspace{1in} &\\ \hline
$60^{\circ}$ & & &   \\

\end{tabular}} \quad
\end{center}

\hrulefill

\textbf{Solve for the missing sides}\\

\begin{multicols}{3}
\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){12}
	\tkzLabelSegment[above right=2pt](b,c){$x$}
	\tkzLabelSegment[above left=2pt](a,b){$y$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item $x=\underline{\hspace{1in}}$\\

\item $y=\underline{\hspace{1in}}$\\

\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$h$}
	\tkzLabelSegment[above right=2pt](b,c){$12$}
	\tkzLabelSegment[above left=2pt](a,b){$k$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $h=\underline{\hspace{1in}}$\\

\item $k=\underline{\hspace{1in}}$\\
\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$a$}
	\tkzLabelSegment[above right=2pt](b,c){$b$}
	\tkzLabelSegment[above left=2pt](a,b){$12$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $a=\underline{\hspace{1in}}$\\

\item $b=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\begin{multicols}{2}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[above left=2pt](a,c){$p$}
	\tkzLabelSegment[above right=2pt](b,c){$q$}
	\tkzLabelSegment[below=2pt](a,b){$4$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item[15.] $p=\underline{\hspace{1in}}$\\

\item[16.] $q=\underline{\hspace{1in}}$

\end{enumerate}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,b){$r$}
	\tkzLabelSegment[above right=2pt](b,c){$4$}
	\tkzLabelSegment[above left=2pt](a,c){$s$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item[17.] $r=\underline{\hspace{1in}}$\\

\item[18.] $s=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\section*{Right Triangle Trigonometry Quiz}

\vspace{12pt}

 \hfill NAME:\underline{\hspace{3in}}\\

 %\hfill DATE:\underline{\hspace{2in}}\\

\subsection*{SOH-CAH-TOA}

\textbf{Directions:} Find the trigonometric ratios of the triangle below. Keep track of which angle is which. Reduce your fractions to lowest terms.\\

$$a^2+b^2=c^2$$

$$\sin(\theta)=\dfrac{opp}{hyp} \hspace{1cm} \cos(\theta)=\dfrac{adj}{hyp} \hspace*{1cm} \tan(\theta)=\dfrac{opp}{adj}$$
\begin{center}
\begin{tikzpicture}[scale=.75]

	\coordinate (p) at (0,0);
	\coordinate (q) at (12,0);
	\coordinate (r) at (12,5);
	\draw[line width=3pt] (p) -- (q) -- (r) -- cycle;
	\tkzMarkRightAngle[size=.5](p,q,r)
%	\tkzMarkAngle(q,p,r)
	\tkzLabelAngle[pos=2](q,p,r){$\alpha$}
	\tkzMarkAngle(p,r,q)
	\tkzLabelAngle[pos=1.5](q,r,p){$\beta$}
	\tkzLabelSegment[below=2pt](p,q){$24$}
	\tkzLabelSegment[right=2pt](q,r){$10$}
	\tkzLabelSegment[above left = 2pt](r,p){$C$}

\end{tikzpicture}
\end{center}

\begin{enumerate}

	\item $C=\underline{\hspace{1cm}}$\\

\begin{multicols}{2}
		\setlength\itemsep{1cm}

	\item $\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}
\end{enumerate}

\pagebreak

\subsection*{Special Triangles}

\begin{enumerate}[resume]
	\item Fill in the missing parts of the special triangles and the chart.(1 pt each)\\
\end{enumerate}

\begin{center}
\begin{tikzpicture}[scale=2.5]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.732,0);
	\coordinate (c) at (1.732,1);

	\coordinate (d) at (3,0);
	\coordinate (e) at (4,0);
	\coordinate (f) at (4,1);

	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle (a,b,c)
	\tkzLabelSegment[right=2pt](b,c){1}
	\tkzLabelSegment[below=15pt](a,b){$\underline{\hspace{1cm}}$}
	\tkzLabelSegment[above left=2pt](c,a){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.5](c,a,b){$\underline{\hspace{1cm}}^{\circ}$}
	\tkzLabelAngle[pos=.3](a,c,b){$60^{\circ}$}

	\draw[line width=2pt] (d) -- (e) -- (f) --cycle;
	\tkzMarkRightAngle(d,e,f)
	\tkzLabelSegment[below=15pt](d,e){\underline{\hspace{1cm}}}
	\tkzLabelSegment[right=2pt](e,f){1}
	\tkzLabelSegment[above left=2pt](f,d){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.3](f,d,e){$45^{\circ}$}
	\tkzLabelAngle[pos=.4](e,f,d){$\underline{\hspace{.7cm}}^{\circ}$}

\end{tikzpicture}

 \vspace{1cm}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{ l | c | c | c }

$\theta$ & $\sin(\theta)$  & $\cos(\theta)$ & \hspace{.3in}$\tan(\theta)$ \hspace{.3in} \\ \hline
$30^{\circ}$ & \hspace{1in} & &\\ \hline
$45^{\circ}$ & & \hspace{1in} &\\ \hline
$60^{\circ}$ & & &   \\

\end{tabular}} \quad
\end{center}

\hrulefill

\textbf{Solve for the missing sides}\\

\begin{multicols}{3}
\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){18}
	\tkzLabelSegment[above right=2pt](b,c){$f$}
	\tkzLabelSegment[above left=2pt](a,b){$g$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item $f=\underline{\hspace{1in}}$\\

\item $g=\underline{\hspace{1in}}$\\

\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$m$}
	\tkzLabelSegment[above right=2pt](b,c){$18$}
	\tkzLabelSegment[above left=2pt](a,b){$n$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $m=\underline{\hspace{1in}}$\\

\item $n=\underline{\hspace{1in}}$\\
\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$q$}
	\tkzLabelSegment[above right=2pt](b,c){$r$}
	\tkzLabelSegment[above left=2pt](a,b){$18$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $q=\underline{\hspace{1in}}$\\

\item $r=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\begin{multicols}{2}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[above left=2pt](a,c){$t$}
	\tkzLabelSegment[above right=2pt](b,c){$v$}
	\tkzLabelSegment[below=2pt](a,b){$8$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume] %the resume function isn't working due to a nesting problem

\item[15.] $t=\underline{\hspace{1in}}$\\

\item[16.] $v=\underline{\hspace{1in}}$

\end{enumerate}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,b){$w$}
	\tkzLabelSegment[above right=2pt](b,c){$8$}
	\tkzLabelSegment[above left=2pt](a,c){$s$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item[17.] $w=\underline{\hspace{1in}}$\\

\item[18.] $s=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\section*{Post Quiz Extra Credit}

\hfill \textbf{NAME:}\underline{\hspace{3in}}\\

\textbf{Directions:} Solve the unknown sides of each of the triangles. All questions must be correct for credit. \\

\begin{multicols}{3}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (3,0);
	\coordinate (t) at (3,5.196152423);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.5](r,t,s){$30^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle(s,r,t){$60^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$6$}
	\tkzLabelSegment[right = 2pt](s,t){$a$}
	\tkzLabelSegment[above left = 2pt](t,r){$b$}

	\end{tikzpicture}

		\begin{enumerate}

			\item $a=$\underline{\hspace{1in}}\\

			\item $b=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (3,0);
	\coordinate (t) at (3,5.196152423);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.5](r,t,s){$30^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle(s,r,t){$60^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$c$}
	\tkzLabelSegment[right = 2pt](s,t){$6$}
	\tkzLabelSegment[above left = 2pt](t,r){$d$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item $c=$\underline{\hspace{1in}}\\

			\item $d=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (3,0);
	\coordinate (t) at (3,5.196152423);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.5](r,t,s){$30^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle(s,r,t){$60^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$e$}
	\tkzLabelSegment[right = 2pt](s,t){$f$}
	\tkzLabelSegment[above left = 2pt](t,r){$6$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item $e=$\underline{\hspace{1in}}\\

			\item $f=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\vspace{1in}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$24$}
	\tkzLabelSegment[right = 2pt](s,t){$g$}
	\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[7.] $g=$\underline{\hspace{1in}}\\ %there's a problem with the enumeration nested in the multicols. The resume function therefore doesn't work properly.

			\item[8.] $h=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$24$}
	\tkzLabelSegment[above left = 2pt](t,r){$k$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[9.] $j=$\underline{\hspace{1in}}\\

			\item[10.] $k=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\pagebreak

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (x) at (0,0);
	\coordinate (y) at (3,0);
	\coordinate (z) at (3,3);
	\draw[line width=2pt](x) -- (y) -- (z) -- cycle;

	\tkzMarkRightAngle[size=.6](x,y,z)
	\tkzLabelAngle(x,z,y){$45^\circ$}
	\tkzLabelAngle(y,x,z){$45^\circ$}

	\tkzLabelSegment[below = 2pt](x,y){$m$}
	\tkzLabelSegment[right = 2pt](y,z){$n$}
	\tkzLabelSegment[above left = 2pt](z,x){$8$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[11.] $m=$\underline{\hspace{1in}}\\

			\item[12.] $n=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (x) at (0,0);
	\coordinate (y) at (3,0);
	\coordinate (z) at (3,3);
	\draw[line width=2pt](x) -- (y) -- (z) -- cycle;

	\tkzMarkRightAngle[size=.6](x,y,z)
	\tkzLabelAngle(x,z,y){$45^\circ$}
	\tkzLabelAngle(y,x,z){$45^\circ$}

	\tkzLabelSegment[below = 2pt](x,y){$8$}
	\tkzLabelSegment[right = 2pt](y,z){$p$}
	\tkzLabelSegment[above left = 2pt](z,x){$q$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[13.] $p=$\underline{\hspace{1in}}\\

			\item[14.] $q=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\section*{Right Triangle Trigonometry Re-Quiz}

\vspace{12pt}

 \hfill NAME:\underline{\hspace{3in}}\\

 %\hfill DATE:\underline{\hspace{2in}}\\

\subsection*{SOH-CAH-TOA}

\textbf{Directions:} Find the trigonometric ratios of the triangle below. Keep track of which angle is which. Reduce your fractions to lowest terms.\\

$$a^2+b^2=c^2$$

$$\sin(\theta)=\dfrac{opp}{hyp} \hspace{1cm} \cos(\theta)=\dfrac{adj}{hyp} \hspace*{1cm} \tan(\theta)=\dfrac{opp}{adj}$$
\begin{center}
\begin{tikzpicture}[scale=1.2]

	\coordinate (p) at (0,0);
	\coordinate (q) at (4,0);
	\coordinate (r) at (4,3);
	\draw[line width=3pt] (p) -- (q) -- (r) -- cycle;
	\tkzMarkRightAngle[size=.5](p,q,r)
%	\tkzMarkAngle(q,p,r)
	\tkzLabelAngle[pos=2](q,p,r){$\alpha$}
	\tkzMarkAngle(p,r,q)
	\tkzLabelAngle[pos=1.5](q,r,p){$\beta$}
	\tkzLabelSegment[below=2pt](p,q){$8$}
	\tkzLabelSegment[right=2pt](q,r){$6$}
	\tkzLabelSegment[above left = 2pt](r,p){$C$}

\end{tikzpicture}
\end{center}

\begin{enumerate}

	\item $C=\underline{\hspace{1cm}}$\\

\begin{multicols}{2}
		\setlength\itemsep{1cm}

	\item $\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}
\end{enumerate}

\pagebreak

\subsection*{Special Triangles}

\begin{enumerate}[resume]
	\item Fill in the missing parts of the special triangles and the chart.(1 pt each)\\
\end{enumerate}

\begin{center}
\begin{tikzpicture}[scale=2.5]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.732,0);
	\coordinate (c) at (1.732,1);

	\coordinate (d) at (3,0);
	\coordinate (e) at (4,0);
	\coordinate (f) at (4,1);

	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle (a,b,c)
	\tkzLabelSegment[right=2pt](b,c){1}
	\tkzLabelSegment[below=15pt](a,b){$\underline{\hspace{1cm}}$}
	\tkzLabelSegment[above left=2pt](c,a){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.5](c,a,b){$\underline{\hspace{1cm}}^{\circ}$}
	\tkzLabelAngle[pos=.3](a,c,b){$60^{\circ}$}

	\draw[line width=2pt] (d) -- (e) -- (f) --cycle;
	\tkzMarkRightAngle(d,e,f)
	\tkzLabelSegment[below=15pt](d,e){\underline{\hspace{1cm}}}
	\tkzLabelSegment[right=2pt](e,f){1}
	\tkzLabelSegment[above left=2pt](f,d){\underline{\hspace{1cm}}}
	\tkzLabelAngle[pos=.3](f,d,e){$45^{\circ}$}
	\tkzLabelAngle[pos=.4](e,f,d){$\underline{\hspace{.7cm}}^{\circ}$}

\end{tikzpicture}

 \vspace{1cm}

{\renewcommand{\arraystretch}{2}
\begin{tabular}{ l | c | c | c }

$\theta$ & $\sin(\theta)$  & $\cos(\theta)$ & \hspace{.3in}$\tan(\theta)$ \hspace{.3in} \\ \hline
$30^{\circ}$ & \hspace{1in} & &\\ \hline
$45^{\circ}$ & & \hspace{1in} &\\ \hline
$60^{\circ}$ & & &   \\

\end{tabular}} \quad
\end{center}

\hrulefill

\textbf{Solve for the missing sides}\\

\begin{multicols}{3}
\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){15}
	\tkzLabelSegment[above right=2pt](b,c){$f$}
	\tkzLabelSegment[above left=2pt](a,b){$g$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item $f=\underline{\hspace{1in}}$\\

\item $g=\underline{\hspace{1in}}$\\

\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$m$}
	\tkzLabelSegment[above right=2pt](b,c){$15$}
	\tkzLabelSegment[above left=2pt](a,b){$n$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $m=\underline{\hspace{1in}}$\\

\item $n=\underline{\hspace{1in}}$\\
\end{enumerate}

\begin{tikzpicture}

	\coordinate (a) at (0,0);
	\coordinate (b) at (1,1.73205);
	\coordinate (c) at (4,0);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,c){$q$}
	\tkzLabelSegment[above right=2pt](b,c){$r$}
	\tkzLabelSegment[above left=2pt](a,b){$15$}
	\tkzMarkRightAngle[size=.5](a,b,c)
	\tkzLabelAngle[pos = .7](b,a,c){$60^{\circ}$}
	\tkzLabelAngle[pos=1](b,c,a){$30^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]
\item $q=\underline{\hspace{1in}}$\\

\item $r=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\begin{multicols}{2}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[above left=2pt](a,c){$t$}
	\tkzLabelSegment[above right=2pt](b,c){$v$}
	\tkzLabelSegment[below=2pt](a,b){$16$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume] %the resume function isn't working due to a nesting problem

\item[15.] $t=\underline{\hspace{1in}}$\\

\item[16.] $v=\underline{\hspace{1in}}$

\end{enumerate}

\begin{tikzpicture}[scale=2.3]

	\coordinate (a) at (0,0);
	\coordinate (b) at (1.4142135,0);
	\coordinate (c) at (0.707106781,0.707106781);
	\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;

	\tkzLabelSegment[below=2pt](a,b){$w$}
	\tkzLabelSegment[above right=2pt](b,c){$16$}
	\tkzLabelSegment[above left=2pt](a,c){$s$}
	\tkzMarkRightAngle(a,c,b)
	\tkzLabelAngle[pos = .3](a,b,c){$45^{\circ}$}
	\tkzLabelAngle[pos=.3](c,a,b){$45^{\circ}$}

\end{tikzpicture}

\begin{enumerate}[resume]

\item[17.] $w=\underline{\hspace{1in}}$\\

\item[18.] $s=\underline{\hspace{1in}}$\\

\end{enumerate}
\end{multicols}

\section*{Solving for Any Right Triangle}

\subsection*{Decimals}

**To solve for any right triangle you will need either a trig table or a calculator** \\

A trig ratio is a fraction that compares the sides of a triangle. Any fraction can be written (or approximated) as a decimal.

\begin{align*}
\sin(60^\circ)&=\dfrac{\sqrt{3}}{2}  &\text{we know from our chart}\\
\sin(60^\circ)&\approx 0.8660254... &\text{we obtain from the calculator}\\
\hspace{1in}\dfrac{\sqrt{3}}{2} &\approx  0.8660254...& \text{therefore this must be true}\\
\end{align*}

These decimals are approximations. For the non-special angles the approximation is just fine, but for the special angles keep to the exact radical/fraction form unless otherwise noted.\\

Any angle can be plugged into the trig functions. \\

\textbf{Example 1:} $25^\circ$
\begin{center}
\begin{BVerbatim}
	sin(25) = 0.422618626...
	cos(25) = 0.906307787...
	tan(25) = 0.466307658...
\end{BVerbatim}
\end{center}

\textbf{You Try:} Evaluate the trig functions of the following angles on your calculator. Round to 4 decimal places.\\

\begin{enumerate}
\begin{multicols}{2}

\item	\begin{enumerate}
			\item $\sin(50^\circ)=$

			\item $\cos(50^\circ)=$

			\item $\tan(50^\circ)=$\\
		\end{enumerate}

\item \begin{enumerate}
			\item $\sin(37^\circ)=$

			\item $\cos(37^\circ)=$

			\item $\tan(37^\circ)=$\\
		\end{enumerate}

\item \begin{enumerate}
			\item $\sin(90^\circ)=$

			\item $\cos(90^\circ)=$

			\item $\tan(90^\circ)=$\\
		\end{enumerate}

\item \begin{enumerate}
			\item $\sin(0^\circ)=$

			\item $\cos(0^\circ)=$

			\item $\tan(0^\circ)=$\\
		\end{enumerate}
\end{multicols}
\end{enumerate}

Did you notice anything weird with 3 and 4?

\pagebreak

\subsection*{Using Decimals to Solve Triangles}

The calculator (or trig table) can determine a trig value for any angle. Therefore we can substitute the trig function with a number and determine how long an unknown side is.\\

\begin{center}

	\begin{tikzpicture}[scale=1]

		\coordinate (a) at (0,0);
		\coordinate (b) at (8,0);
		\coordinate (c) at (8,3);
		\draw[line width=2pt] (a) -- (b) -- (c) -- cycle;
		\tkzMarkRightAngle[size=.5](a,b,c)
		\tkzMarkAngle(b,a,c)
		\tkzLabelAngle[pos=1.7](c,a,b){$21^\circ$}
		\tkzLabelSegment[below = 2pt](a,b){$8$}
		\tkzLabelSegment[right = 2pt](b,c){$x$}
	\end{tikzpicture}
\end{center}

This triangle has a known side \textit{adjacent} to $21^\circ$, and since we want to know the value of $x$, \textit{opposite} of $20^\circ$ we will use \textbf{Tangent}.

\begin{align*}
\tan(21^\circ)&=0.383864035... 	&\text{from calculator}\\
\tan(21^\circ)&=\frac{x}{8}   	&\text{from triangle}\\
8\tan(21^\circ)&=x 			   	&\text{solved for } x\\
8 \cdot 0.383864035... &= x		&\text{subtitute out}\tan(21^\circ)
\end{align*}

$$x \approx 3.0709$$

\hrulefill

\begin{center}
\begin{tikzpicture}[scale=.6]

\coordinate (h) at (0,0); %USE DIFFERENT TRIANGLE maybe 36 degrees
\coordinate (j) at (8.090169944,0);
\coordinate (k) at (0,5.877852523);
\draw[line width= 2pt](h) -- (j) -- (k) -- cycle;
\tkzMarkRightAngle[size=.7](k,h,j)
\tkzLabelAngle[pos=2](h,j,k){$36^\circ$}
\tkzMarkAngle(k,j,h)
\tkzLabelSegment[below = 2pt](h,j){$b$}
%\tkzLabelSegment[left = 2pt](h,k){$a$}
\tkzLabelSegment[above right = 2pt](j,k){$10$}

\end{tikzpicture}
\end{center}

\begin{align*}
\cos(36^\circ)&=0.809016994... 	&\text{from calculator}\\
\cos(36^\circ)&=\frac{b}{10}   	&\text{from triangle}\\
10\cos(36^\circ)&=b 			   	&\text{solved for } b\\
10 \cdot 0.809016994... &= b		&\text{subtitute out}\cos(36^\circ)
\end{align*}

$$b \approx 8.0902$$

\pagebreak

\textbf{You Try:} Solve for the missing side using your calculator or a trig table.\\

\begin{center}
\begin{tikzpicture}

\coordinate (d) at (0,0);
\coordinate (e) at (0,4);
\coordinate (f) at (10.989909678,0);
\draw[line width = 2pt] (d) -- (e) -- (f) -- cycle;
\tkzMarkRightAngle[size=.6](e,d,f)
\tkzLabelAngle[pos=1.5](d,e,f){$70^\circ$}
\tkzMarkAngle(d,e,f)
\tkzLabelSegment[below = 2pt](d,f){$m$}
\tkzLabelSegment[left = 2pt](d,e){$2$}

\end{tikzpicture}
\end{center}

\vspace{2in}

$$m=\underline{\hspace{1in}}$$

\hrulefill

\begin{center}
\begin{tikzpicture}[scale=1.25]

\coordinate (f) at (0,0);
\coordinate (g) at (9,0);
\coordinate (h) at (0.271383206,-1.539090645);
\draw[line width = 2pt](f) -- (g) -- (h) -- cycle;
\tkzMarkRightAngle[size=.5](f,h,g)
\tkzMarkAngle[size=.5](h,f,g)
\tkzLabelAngle[pos = .8](g,f,h){$80^\circ$}
\tkzLabelSegment[below right = 2pt](g,h){$x$}
\tkzLabelSegment[above = 2pt](f,g){$9$}

\end{tikzpicture}
\end{center}

\vspace{2in}

$$x=\underline{\hspace{1in}}$$

\section*{Inverse Trig Functions}

Use inverse trig functions to find the \underline{angle} from the \underline{side lengths}. They cancel out the trig function so that it will go away and we can get whatever's inside of the parenthesis. \\

Recall from function notation that $$f^{-1}(f(x))=x$$

The same holds true with trig functions. They are used to find out the value of $\theta$. \\

\begin{large}
$$\sin^{-1}(\sin(\theta))=\theta \hspace{1in} \cos^{-1}(\cos(\theta))=\theta \hspace*{1in} \tan^{-1}(\tan(\theta))=\theta$$\\
\end{large}

\textbf{Example:}

\begin{center}
\begin{tikzpicture}[scale=1.5]

	\coordinate (a) at (0,0);
	\coordinate (c) at (3,0);
	\coordinate (b) at (0,2);
	\draw[line width = 2pt] (a) -- (b) -- (c) -- cycle;
	\tkzMarkRightAngle[size=.5](b,a,c)
	\tkzMarkAngle[size=.6](a,b,c)
	\tkzLabelAngle[pos=.8](a,b,c){$\theta$}
	\tkzLabelSegment[below=2pt](a,c){$3$}
	\tkzLabelSegment[left=2pt](a,b){$2$}

\end{tikzpicture}
\end{center}

To remove the $\theta$ from the \textsl{tan} we use \textit{inverse tan} on both sides.\\

\begin{eqnarray*}
\tan(\theta)&=&\dfrac{3}{2}\\
\tan^{-1}(\tan(\theta))&=&\tan^{-1}\left(\frac{3}{2}\right) \\
\theta &=&\tan^{-1}\left(\frac{3}{2}\right) \\
\theta &\approx & 56.31^\circ \\
\end{eqnarray*}

Another word for \textit{inverse sine} is \textbf{arcsine}. Also \textit{inverse cosine} is \textbf{arccos}, and \textit{inverse tangent} is \textbf{arctan}. This is likely how they are labelled on your cellphone calculators.

\section*{Right Triangle Trig Test Review}

Mr. Wolf \hfill NAME:\underline{\hspace{3in}}

\subsection*{Trig Ratios}

$$\sin(\theta)=\dfrac{opp}{hyp} \hspace{1cm} \cos(\theta)=\dfrac{adj}{hyp} \hspace*{1cm} \tan(\theta)=\dfrac{opp}{adj}$$
\begin{center}
\begin{tikzpicture}[scale=.75]

	\coordinate (p) at (0,0);
	\coordinate (q) at (7.5,0);
	\coordinate (r) at (7.5,4);
	\draw[line width=3pt] (p) -- (q) -- (r) -- cycle;
	\tkzMarkRightAngle[size=.5](p,q,r)
	\tkzMarkAngle(q,p,r)
	\tkzLabelAngle[pos=1.3](q,p,r){$\alpha$}
	\tkzMarkAngle(p,r,q)
	\tkzLabelAngle[pos=1.3](q,r,p){$\beta$}
	\tkzLabelSegment[below=2pt](p,q){$15$}
	\tkzLabelSegment[right=2pt](q,r){$8$}
	\tkzLabelSegment[above left = 2pt](r,p){$17$}

\end{tikzpicture}
\end{center}

\begin{enumerate}
\begin{multicols}{2}
		\setlength\itemsep{.5cm}

	\item $\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}
\end{enumerate}

\hrulefill

\subsection*{Solve for Missing Sides}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1](r,t,s){$57^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	%\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$24$}
	\tkzLabelSegment[right = 2pt](s,t){$g$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[7.] $g=$\underline{\hspace{1in}}\\ %there's a problem with the enumeration nested in the multicols. The resume function therefore doesn't work properly. I copied this from above because the spacing wasn't working for some reason. Extremely frustrating, but do whatever works, right?

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$25^\circ$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$24$}
	\tkzLabelSegment[above left = 2pt](t,r){$k$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[8.] $k=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\pagebreak

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1](r,t,s){$65^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	%\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$12$}
	\tkzLabelSegment[right = 2pt](s,t){$p$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[9.] $p=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$39^\circ$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$24$}
	\tkzLabelSegment[above left = 2pt](t,r){$q$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[10.] $q=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\vspace{1cm}

\hrulefill

\subsection*{Solving for an Angle}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.4](r,t,s){$x$}

	\tkzLabelSegment[below = 2pt](r,s){$17$}
	\tkzLabelSegment[right = 2pt](s,t){$10$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[11.] $x=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$y$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$4$}
	\tkzLabelSegment[above left = 2pt](t,r){$8$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[12.] $y=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\vspace{1cm}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.4](r,t,s){$z$}

	%\tkzLabelSegment[below = 2pt](r,s){$17$}
	\tkzLabelSegment[right = 2pt](s,t){$5$}
	\tkzLabelSegment[above left = 2pt](t,r){$10$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[13.] $z=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$t$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$7$}
	\tkzLabelSegment[above left = 2pt](t,r){$9$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[14.] $t=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\section*{Right Triangle Trig Test}

Mr. Wolf \hfill NAME:\underline{\hspace{3in}}

\subsection*{Trig Ratios}

$$\sin(\theta)=\dfrac{opp}{hyp} \hspace{1cm} \cos(\theta)=\dfrac{adj}{hyp} \hspace*{1cm} \tan(\theta)=\dfrac{opp}{adj}$$
\begin{center}
\begin{tikzpicture}[scale=.75]

	\coordinate (p) at (0,0);
	\coordinate (q) at (12,0);
	\coordinate (r) at (12,3.5);
	\draw[line width=3pt] (p) -- (q) -- (r) -- cycle;
	\tkzMarkRightAngle[size=.5](p,q,r)
	\tkzMarkAngle(q,p,r)
	\tkzLabelAngle[pos=1.3](q,p,r){$\alpha$}
	\tkzMarkAngle(p,r,q)
	\tkzLabelAngle[pos=1.3](q,r,p){$\beta$}
	\tkzLabelSegment[below=2pt](p,q){$24$}
	\tkzLabelSegment[right=2pt](q,r){$7$}
	\tkzLabelSegment[above left = 2pt](r,p){$25$}

\end{tikzpicture}
\end{center}

\begin{enumerate}
\begin{multicols}{2}
		\setlength\itemsep{.5cm}

	\item $\sin(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\alpha) = \frac{\hspace{1cm}}{ }$\\

	\item $\sin(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\cos(\beta) = \frac{\hspace{1cm}}{ }$\\

	\item $\tan(\beta) = \frac{\hspace{1cm}}{ }$\\

\end{multicols}
\end{enumerate}

\hrulefill

\subsection*{Solve for Missing Sides}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1](r,t,s){$64^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	%\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$h$}
	\tkzLabelSegment[right = 2pt](s,t){$24$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[7.] $h=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$25^\circ$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$6$}
	\tkzLabelSegment[above left = 2pt](t,r){$m$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[8.] $m=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\pagebreak

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	%\tkzLabelAngle(s,r,t){$30^\circ$}

	\tkzLabelSegment[below = 2pt](r,s){$n$}
	\tkzLabelSegment[right = 2pt](s,t){$8$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[9.] $n=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	%\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$33^\circ$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$2$}
	\tkzLabelSegment[above left = 2pt](t,r){$f$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[10.] $f=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\vspace{1cm}

\hrulefill

\subsection*{Solving for an Angle}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.4](r,t,s){$x$}

	\tkzLabelSegment[below = 2pt](r,s){$20$}
	\tkzLabelSegment[right = 2pt](s,t){$5$}
	%\tkzLabelSegment[above left = 2pt](t,r){$h$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[11.] $x=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$y$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$1$}
	\tkzLabelSegment[above left = 2pt](t,r){$3$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[12.] $y=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}

\vspace{1cm}

\begin{multicols}{2}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	\tkzMarkAngle[pos=.5](r,t,s)
	\tkzLabelAngle[pos=1.4](r,t,s){$z$}

	%\tkzLabelSegment[below = 2pt](r,s){$17$}
	\tkzLabelSegment[right = 2pt](s,t){$25$}
	\tkzLabelSegment[above left = 2pt](t,r){$50$}

	\end{tikzpicture}

		\begin{enumerate}

			\item[13.] $z=$\underline{\hspace{1in}}\\

		\end{enumerate}

	\begin{tikzpicture}

	\coordinate (r) at (0,0);
	\coordinate (s) at (5.196152423,0);
	\coordinate (t) at (5.196152423,3);
	\draw[line width=2pt](r) -- (s) -- (t) -- cycle;

	\tkzMarkRightAngle[size=.7](r,s,t)
	%\tkzMarkAngle[pos=.5](r,t,s)
	%\tkzLabelAngle[pos=1.5](r,t,s){$60^\circ$}
	\tkzMarkAngle[pos=0](s,r,t)
	\tkzLabelAngle[pos=1.2](s,r,t){$t$}

	%\tkzLabelSegment[below = 2pt](r,s){$j$}
	\tkzLabelSegment[right = 2pt](s,t){$8$}
	\tkzLabelSegment[above left = 2pt](t,r){$12$}

	\end{tikzpicture}

		\begin{enumerate}[resume]

			\item[14.] $t=$\underline{\hspace{1in}}\\

		\end{enumerate}

\end{multicols}
\end{document}


\documentclass{article}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}
\usepackage{multirow}
\setlength\parindent{0pt}
\usepackage{geometry}
\usepackage{longtable}
\usepackage{float}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}

\title{Catagorical Data Analysis HW2}
\author{Faizan Khalid Mohsin}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}
\maketitle

\section*{Question 1}
Describe the rationale for accommodating excess zeros in the model. Cover
both how these data indicate the necessity for such accommodation and why
this indication should not be ignored. [8 points]

\vspace{5mm}

{\bf Answer:} First, we plot the histogram of the number of drinks consumed by the participantS over the past 24 hours.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{daata} \hlkwb{=} \hlkwd{read.csv}\hlstd{(}\hlstr{"assignment2_data.csv"}\hlstd{)}

\hlkwd{qplot}\hlstd{(etoh,} \hlkwc{data}\hlstd{=daata,} \hlkwc{geom}\hlstd{=}\hlstr{"histogram"}\hlstd{,} \hlkwc{main} \hlstd{=} \hlstr{"Histogram of drinks consumed by participants in the last 24 hours"}\hlstd{)}
\end{alltt}
\end{kframe}

{\centering \includegraphics[width=\maxwidth]{figure/unnamed-chunk-2-1}

}

\end{knitrout}

We can see that at zero there is a sudden spike as well as at 2. Apart from this two particular spikes the distribution of the number of drinks consumed by the participants over the past 24 hours looks more or less like the poisson distribution (of a poisson count data). Hence, this would suggest one to model the data as poisson ditribution. However, the spike seems to contain some information about something unique happening at zero, i.e. a lot more people are not drinking any alchohol in the last 24 hours than expected. Hence, we would like to incorporate this feature of the data into our model so that our model fits the data better and is able to give more informative analysis  (information) and insight and shed more light on the matter to examine patient characteristics associated with self-medication through alcohol consumption.

\vspace{5mm}

We now fit a poisson distribution to show how well such a distribution fits the data.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# # Fitting the poisson regression:}
\hlcom{# }
\hlcom{# summary(m1 <- glm(etoh ~ hx + ptsdsx + affect, family="poisson", data=daata))}
\hlcom{# }
\hlcom{# # Estimating the counts:}
\hlcom{# }
\hlcom{# pois_counts1 = predict(m1, daata, type="response", se.fit=TRUE)$fit}

\hlcom{# estimating the poisson parameter lambda from the data}
\hlstd{parms} \hlkwb{<-} \hlkwd{fitdistr}\hlstd{(daata}\hlopt{$}\hlstd{etoh,} \hlstr{"poisson"}\hlstd{)}
\hlstd{parms}
\end{alltt}
\begin{verbatim}
##     lambda
##   2.2083333
##  (0.2144923)
\end{verbatim}
\begin{alltt}
\hlstd{lambda} \hlkwb{<-} \hlstd{parms}\hlopt{$}\hlstd{estimate}
\hlstd{lambda}
\end{alltt}
\begin{verbatim}
##   lambda
## 2.208333
\end{verbatim}
\begin{alltt}
\hlcom{# producing the poisson counts using the estimated lambda}
\hlstd{n} \hlkwb{=} \hlkwd{sum}\hlstd{(}\hlkwd{c}\hlstd{(}\hlnum{8}\hlstd{,}\hlnum{5}\hlstd{,}\hlnum{17}\hlstd{,}\hlnum{11}\hlstd{,}\hlnum{3}\hlstd{,}\hlnum{2}\hlstd{,}\hlnum{2}\hlstd{))}

\hlstd{poisson_counts} \hlkwb{=} \hlkwd{round}\hlstd{(n}\hlopt{*}\hlkwd{dpois}\hlstd{(}\hlnum{0}\hlopt{:}\hlnum{6}\hlstd{, lambda),} \hlnum{0}\hlstd{)}

\hlkwd{rbind}\hlstd{(}\hlkwd{c}\hlstd{(}\hlnum{0}\hlstd{,}\hlnum{1}\hlstd{,}\hlnum{2}\hlstd{,}\hlnum{3}\hlstd{,}\hlnum{4}\hlstd{,}\hlnum{5}\hlstd{,}\hlnum{6}\hlstd{), poisson_counts)}
\end{alltt}
\begin{verbatim}
##                [,1] [,2] [,3] [,4] [,5] [,6] [,7]
##                   0    1    2    3    4    5    6
## poisson_counts    5   12   13    9    5    2    1
\end{verbatim}
\begin{alltt}
\hlstd{a} \hlkwb{=} \hlkwd{as.character}\hlstd{(}\hlnum{0}\hlopt{:}\hlnum{6}\hlstd{)}
\hlstd{data} \hlkwb{=} \hlkwd{data.frame}\hlstd{(}\hlkwc{etoh} \hlstd{= a,}  \hlkwc{actual_counts} \hlstd{=} \hlkwd{c}\hlstd{(}\hlnum{8}\hlstd{,}\hlnum{5}\hlstd{,}\hlnum{17}\hlstd{,}\hlnum{11}\hlstd{,}\hlnum{3}\hlstd{,}\hlnum{2}\hlstd{,}\hlnum{2}\hlstd{),} \hlkwc{poisson_counts} \hlstd{= poisson_counts)}

\hlcom{# Producing the Histrogram of the two counts side by side. }
\hlstd{datta} \hlkwb{=} \hlkwd{melt}\hlstd{(data)}

\hlkwd{names}\hlstd{(datta)[}\hlnum{3}\hlstd{]} \hlkwb{<-} \hlstr{"counts"}

\hlkwd{ggplot}\hlstd{(datta,} \hlkwd{aes}\hlstd{(etoh,counts,} \hlkwc{fill} \hlstd{= variable),} \hlkwc{xlab}\hlstd{=}\hlstr{"etoh"}\hlstd{)} \hlopt{+}
\hlkwd{geom_bar}\hlstd{(}\hlkwc{stat}\hlstd{=}\hlstr{"identity"}\hlstd{,} \hlkwc{width}\hlstd{=}\hlnum{.5}\hlstd{,} \hlkwc{position} \hlstd{=} \hlstr{"dodge"}\hlstd{)}  \hlopt{+}
  \hlkwd{ggtitle}\hlstd{(}\hlstr{"Histogram of the actual and the poisson counts"}\hlstd{)}
\end{alltt}
\end{kframe}
\includegraphics[width=\maxwidth]{figure/unnamed-chunk-3-1}

\end{knitrout}

We see that the zeros in the actual counts are more than if the data had a poisson distribution. Due to this excess of zeros we would argue to use a hurdle model.

\vspace{5mm}

We also present a table below to compare the actual counts and the counTs we would have obtained if the data followed a poisson distribution more closely.

\vspace{7mm}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}
\begin{tabular}{l|r|r}
\hline
etoh & actual\_counts & poisson\_counts\\
\hline
0 & 8 & 5\\
\hline
1 & 5 & 12\\
\hline
2 & 17 & 13\\
\hline
3 & 11 & 9\\
\hline
4 & 3 & 5\\
\hline
5 & 2 & 2\\
\hline
6 & 2 & 1\\
\hline
\end{tabular}

\end{knitrout}

\vspace{5mm}

Clearly, as we have said before there are more zero in the data then a poisson distribution would have hence the data suggests that we should use a model whiCh incorporates this information into it. Also, we cannot do the Pearson Chi square goodness of fit test because more than 20\% of the events have expected frequencies below 5. If we ignore this access number of zeros we will be loosing a key characteristic of our data. It is important not to ignore this because if we assume the model has poisson distribution and infact it does not then we will be violating one of the assumptions of the model and our conclusions from the model may be end up being completely wrong.

\vspace{5mm}

% Lastly, we will do a Vuong test to test if a poisson model is better or the model that in corporates the excess zeros called the hurdle model.

\section*{Question 2}

Fit and interpret a hurdle model (with Poisson count distribution) for etoh that contains main effects of hx, ptsdsx, and affect. Do not include interaction terms in the model. Note, the pscl package in R contains a hurdle model fitting function. [12 points]

\vspace{5mm}

{\bf Answer:} Below we fit the specified hurdle model.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{## hurdle model}
\hlstd{model1} \hlkwb{<-} \hlkwd{hurdle}\hlstd{(}\hlkwc{formula} \hlstd{= etoh} \hlopt{~} \hlstd{hx} \hlopt{+} \hlstd{ptsdsx} \hlopt{+} \hlstd{affect,}
                             \hlkwc{dist}    \hlstd{=} \hlstr{"poisson"}\hlstd{,}
                             \hlkwc{data}    \hlstd{= daata)}
\hlkwd{summary}\hlstd{(model1)}
\end{alltt}
\begin{verbatim}
##
## Call:
## hurdle(formula = etoh ~ hx + ptsdsx + affect, data = daata, dist = "poisson")
##
## Pearson residuals:
##      Min       1Q   Median       3Q      Max
## -2.13296 -0.70557 -0.09372  0.66604  2.04372
##
## Count model coefficients (truncated poisson with log link):
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.7685     0.3483   2.207   0.0273 *
## hx           -0.3811     0.2885  -1.321   0.1864
## ptsdsx       -0.2974     0.1434  -2.073   0.0381 *
## affect        0.2457     0.1149   2.137   0.0326 *
## Zero hurdle model coefficients (binomial with logit link):
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   1.9799     1.4014   1.413   0.1577
## hx           -2.2233     0.9122  -2.437   0.0148 *
## ptsdsx       -0.1978     0.4186  -0.473   0.6365
## affect        0.3603     0.3565   1.011   0.3122
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Number of iterations in BFGS optimization: 10
## Log-likelihood: -77.44 on 8 Df
\end{verbatim}
\begin{alltt}
\hlstd{expCoef} \hlkwb{<-} \hlkwd{exp}\hlstd{(}\hlkwd{coef}\hlstd{((model1)))}
\hlstd{expCoef}
\end{alltt}
\begin{verbatim}
## count_(Intercept)          count_hx      count_ptsdsx      count_affect
##         2.1565703         0.6830924         0.7427388         1.2784578
##  zero_(Intercept)           zero_hx       zero_ptsdsx       zero_affect
##         7.2420276         0.1082484         0.8205302         1.4337554
\end{verbatim}
\end{kframe}
\end{knitrout}

\subsection*{Interpreting the count model}

The average number of drinks a person has had in the last 24 hours is 2. This average number of drinks in the last 24 hours is increased by 1.3 times if a person's emotional state improves by one unit on the emotional state score. However, an increase in one unit of Post-Traumatic Stress Disorder severity score, decreases the average number of drinks (which is 2) a person had in the last 24 hours by 0.74 times. Both of these variables are statistically siginificant as their pvalues are less than 0.05 (pvalue = 0.0381 and pvalue = 0.0326 respectively). A person's history of alcohol abuse is not statistically significant ( pvalue = 0.1577 is greater than 0.05) meaning that it does not appear to effect the number of average drink he will have in the last 24 hours if he is an alcohol drinker.

% The participant's Post-Traumatic Stress Disorder's degree of severity and the his emotional state over the previous 24 hours affect the number of drinks consumed by the him over the past 24 hours. An increase in one unit on the Post-Traumatic Stress Disorder severity score decreases the average number of drinks a person had in the past 24 hours by 0.74 (exp(-0.2974)) times. An increase in the emotional state of the participant by one unit on the emotional state score, keeping all else unchanged, increases the average number of drink consumed by a person in the last 24 hours by 1.3 (exp(0.2457)) times.

\subsection*{Interpretation of the Zero-hurdle model}

The baseline odds of having drunk alcohol in the last 24 hours versus not having drunk any alcohol in the past 24 hours is 7.24. We can also consider this odds to be the odds of being an alcoholic or not being an alcoholic. This odds of drinking some alcohol versus not drinking any alcohol at all decreases by 0.10 times if the person has a history of alcohol abuse. And this effect is indeed statistically significant since pvalue = 0.015 is less than 0.05. The other variables do not have a statistically significant affect on if the person will drinking or not drink alcohol at all in the past 24 hours or in the other interpretation this means that, the other variables do not affect the odds of a person being alcoholic or not.

\subsection*{General remarks}

Now one potential problem we could have is of multicolinearity. It is possible that the score indicating severity of PTSD symptoms experienced by the participant over the past 24 hours could be correlated with the score indicating the participant's emotional state over the previous 24 hours. From below we see that the two are mildly correlated (cor = 0.4606). Also, from the scatter plot we see that there is some underlying phenomena going on, which has sort of grouped the data points into two clusters. It is possible that these two clusters are two different types of people for example one could be males and others could be females or could be any sort of groups. Now within each cluster the severity of PTSD and the emotional state are negatively correlated. However, the overall correlation we obtained was positive. This is known as the Simpson's paradox and indicates that we should be very careful about the interpretation of our results especially the interpretation of how our variables are associated with one another since looking at the overall association between variables could be completely wrong and misleading and when we actually look at different groups of the data then the true relationship is revealed which could be very different from the overall one. A quick example would be that males and females when looked at seperately, both have a negative correlation between variables. However, looking at them together we get the completely incorrect relationship. Hence, I would suggest to be vary of our results of the hurdle model and accept that it is possible that our interpretations are not correct. We would need to do further group wise analysis on the data.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlkwd{plot}\hlstd{(daata}\hlopt{$}\hlstd{ptsdsx, daata}\hlopt{$}\hlstd{affect,} \hlkwc{xlab} \hlstd{=} \hlstr{"PTSD severity score"}\hlstd{,} \hlkwc{ylab} \hlstd{=} \hlstr{"Emotional State Score"}\hlstd{,} \hlkwc{main} \hlstd{=} \hlstr{"Correlation plot"}\hlstd{)} \hlcom{#daata$hx)}
\end{alltt}
\end{kframe}
\includegraphics[width=\maxwidth]{figure/unnamed-chunk-7-1}
\begin{kframe}\begin{alltt}
\hlkwd{cor}\hlstd{(daata}\hlopt{$}\hlstd{ptsdsx, daata}\hlopt{$}\hlstd{affect)}
\end{alltt}
\begin{verbatim}
## [1] 0.4606311
\end{verbatim}
\end{kframe}
\end{knitrout}

Note that this is an observational study as no experiment was conducted. Hence, it is very highly possible that there are other things outside a person's  PTSD score, their history of alcohol abuse and their emotional state over the previous 24 hours that could be impacting if a person drank alcohol at all in the past 24 hours or not and how many drinks he had. Such as if a person just  obtained some money in the last 24 hours then that could be the actual reason why he had those drinks or if the peson was with friends and because the friends were having drinks or not is why he had that many and the other variables of history of alcohol abuse, PTSD score, etc could be coincidentally, statistically significant in our study.

\vspace{5mm}

Also some of the associations appear to be counter intutive. Such as having a history of alcohol abuse, causing a reduction in the odds of drinking alcohol in the past 24 hours. But it is not so counter intutive if you think about it a little. It is quite possible that those who have a history of alcohol abuse have had therapy and/or done rehab in the past hence are more likely to be able to control themselves and not drink any alcohol. Also, since this is an observational study, then there are many other things that could be affecting the number of drinks a person had in the last 24 hours and hence we causing the associations to appear not as straight forward as one would think.

\section*{Question 3}

The investigator would like to know if any of these three explanatory variables
are superfluous. Please address this query. [4 points]

\vspace{5mm}

{\bf Answer:} It appears that the pearon's history of alcohol abuse does not impact the average number of drinks he has consumed in the past 24 hours as it is not statistically significant (p-value = 0.186, which is greater than 0.05) but it affect the odds of a person having drank alcohol or not at all in the past 24 hours as the p-value is greater than 0.05 (pvalue = 0.0148). Hence, this variable is not suprefluous.

\vspace{5mm}

Secondly, a person's emotional state in the past 24 hours does not affect if he would have drank alcohol or not at all in the past 24 hours, in other words, if he is an alcohol drinker or not (p-value = 0.6365, is greater than 0.05) nor does his Post-Traumatic Stress Disorder severity (p-value = 0.31 > 0.05) affect his odds of having drank alcohol or not at all in the past 24 hours.  His Post-Traumatic Stress Disorder's degree of severity and the his emotional state over the previous 24 hours affect the number of drinks consumed by the him over the past 24 hours as the p-values are greater than 0.05 (pvalues 0.0381 and 0.0326 respectively). Hence, again, neither of the two variables apear to be superfluous. In conclusion none of the variables are superfluous.

% None of the explanatory variables appear to be superfluous because the participant's history of alcohol abuse impacts if he will drink any alchohol or not in the last 24 hours. His Post-Traumatic Stress Disorder's degree of severity and the his emotional state over the previous 24 hours affect the number of drinks consumed by the him over the past 24 hours. Hence, none of the variables appear to be superfluous.

\section*{ Question 4}

The investigator suggested that they have had an affinity for using a forward
selection model building approach that identifies, at each step, candidate
main-effect variables for which the Wald test has a p-value < 0.25. Apply
this model-building algorithm and describe the fitted final model. How does
interpretation of the associations differ between this fitted final model and the fitted model from Question 2 (above). Which model would you recommend as
a more appropriate representation of the data? [8 points]

\vspace{5mm}

{\bf Answer:} We demonstrate this forward selection model building approach below where we start with the model with no explanatory variables and only add one variable at a time and compare the two models using the Wald test, hence testing for the main effect of the added variable.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{## hurdle model}

\hlstd{min.model} \hlkwb{=} \hlkwd{hurdle}\hlstd{(}\hlkwc{formula} \hlstd{= etoh} \hlopt{~} \hlnum{1}\hlstd{,} \hlkwc{dist} \hlstd{=} \hlstr{"poisson"}\hlstd{,} \hlkwc{data} \hlstd{= daata)}

\hlstd{mod0} \hlkwb{=} \hlkwd{hurdle}\hlstd{(}\hlkwc{formula} \hlstd{= etoh} \hlopt{~} \hlstd{hx,} \hlkwc{dist} \hlstd{=} \hlstr{"poisson"}\hlstd{,} \hlkwc{data} \hlstd{= daata)}

\hlkwd{waldtest}\hlstd{(min.model, mod0)}
\end{alltt}
\begin{verbatim}
## Wald test
##
## Model 1: etoh ~ 1
## Model 2: etoh ~ hx
##   Res.Df Df  Chisq Pr(>Chisq)
## 1     46
## 2     44  2 6.8358    0.03278 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
\end{verbatim}
\end{kframe}
\end{knitrout}

Since the p-value = 0.03278 is less than 0.25 we will include variable (hx) that indicates if a person had a history of alcohol abuse or not in the model.

\vspace{5mm}

Now we will include the variable (ptsdsx) which is the score indicating severity of PTSD symptoms experienced by the participant over the past 24 hours into the model.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{## hurdle model}

\hlstd{mod1} \hlkwb{=} \hlkwd{hurdle}\hlstd{(}\hlkwc{formula} \hlstd{= etoh} \hlopt{~} \hlstd{hx} \hlopt{+} \hlstd{ptsdsx,} \hlkwc{dist} \hlstd{=} \hlstr{"poisson"}\hlstd{,} \hlkwc{data} \hlstd{= daata)}

\hlkwd{waldtest}\hlstd{(mod0, mod1)}
\end{alltt}
\begin{verbatim}
## Wald test
##
## Model 1: etoh ~ hx
## Model 2: etoh ~ hx + ptsdsx
##   Res.Df Df  Chisq Pr(>Chisq)
## 1     44
## 2     42  2 1.0604     0.5885
\end{verbatim}
\end{kframe}
\end{knitrout}

For this new variable since its pvalue 0.5885 is greater than 0.25 we will not inlcude it in the model.

\vspace{5mm}

Lastly, we will include the score variable indicating the participants emotional state over the previous 24 hours to the model with the person's history of alcohol abuse.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{## hurdle model}

\hlstd{mod2} \hlkwb{=} \hlkwd{hurdle}\hlstd{(}\hlkwc{formula} \hlstd{= etoh} \hlopt{~} \hlstd{hx} \hlopt{+} \hlstd{affect,} \hlkwc{dist} \hlstd{=} \hlstr{"poisson"}\hlstd{,} \hlkwc{data} \hlstd{= daata)}

\hlkwd{waldtest}\hlstd{(mod0, mod2)}
\end{alltt}
\begin{verbatim}
## Wald test
##
## Model 1: etoh ~ hx
## Model 2: etoh ~ hx + affect
##   Res.Df Df  Chisq Pr(>Chisq)
## 1     44
## 2     42  2 1.8744     0.3917
\end{verbatim}
\end{kframe}
\end{knitrout}

Again since the pvalue 0.39 is greater than 0.25 we will not inlcude it in the model. Hence, the final model that we obtain is the hurdle model with only the histroy of alcohol abuse as the explanatory variable.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlkwd{summary}\hlstd{(mod0)}
\end{alltt}
\begin{verbatim}
##
## Call:
## hurdle(formula = etoh ~ hx, data = daata, dist = "poisson")
##
## Pearson residuals:
##     Min      1Q  Median      3Q     Max
## -1.6462 -0.3769 -0.3352  0.3773  2.1619
##
## Count model coefficients (truncated poisson with log link):
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.9364     0.1240   7.555  4.2e-14 ***
## hx           -0.2515     0.2810  -0.895    0.371
## Zero hurdle model coefficients (binomial with logit link):
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   2.7081     0.7303   3.708 0.000209 ***
## hx           -2.1972     0.8944  -2.457 0.014027 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Number of iterations in BFGS optimization: 7
## Log-likelihood: -80.8 on 4 Df
\end{verbatim}
\begin{alltt}
\hlkwd{exp}\hlstd{(}\hlkwd{coef}\hlstd{(mod0))}  \hlcom{# Exp of Coefficients of the forward stepwise model selectio. }
\end{alltt}
\begin{verbatim}
## count_(Intercept)          count_hx  zero_(Intercept)           zero_hx
##         2.5508239         0.7776298        15.0000000         0.1111111
\end{verbatim}
\begin{alltt}
\hlkwd{exp}\hlstd{(}\hlkwd{coef}\hlstd{(model1))}  \hlcom{# Exp of Coefficients of the full model used in question 2}
\end{alltt}
\begin{verbatim}
## count_(Intercept)          count_hx      count_ptsdsx      count_affect
##         2.1565703         0.6830924         0.7427388         1.2784578
##  zero_(Intercept)           zero_hx       zero_ptsdsx       zero_affect
##         7.2420276         0.1082484         0.8205302         1.4337554
\end{verbatim}
\end{kframe}
\end{knitrout}

{\bf Answer: }     The fitted final model is the hurdle model where only the  person's history of alcohol abuse or not is included. The model says that the average number of drinks a person has had in the past 24 hours is 2.55 and that this is not affected by if he had a histroy of alcohol abuse or not as the pvalue 0.371 is less than 0.05. Further, the model says that the basline odds of drinking alcohol in the past 24 hours versus not drinking any alcohol at all in the past 24 hours is 15. This odds is decreased by 0.11 times if the person had a history of alcohol abuse.

\vspace{5mm}

The interpretation of the association between if a person had a history of alcohol abuse or not and the odds of drinking any alcohol or not and the average number of drinks a person had in the last 24 hours, both are the same in the two models. However, in the model using forward selection the model says that the  severity of PTSD symptoms experienced by the participant over the past 24 hours and  score indicating the participantants emotional state over the previous 24 hours have no effect on the average number of drinks a person had in the last 24 hours. This is because both of these variable are not present in the model. Which is different from the previous model which did say the both these variables affected the average number of drinks a person had in the last 24 hours. One other major difference between the two models is that the full model says that the baseline of someone drinking alcohol versus not drinking any alcohol in the last 24 hours is 7.24, whereas the baseline odds for the model from the stepwise forward selection is 15.0 which is almost double.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{hx_model} \hlkwb{=} \hlkwd{round}\hlstd{(}\hlkwd{colSums}\hlstd{(}\hlkwd{predict}\hlstd{(mod0,} \hlkwc{type} \hlstd{=} \hlstr{"prob"}\hlstd{)[,}\hlnum{1}\hlopt{:}\hlnum{7}\hlstd{]),} \hlnum{0}\hlstd{)}
\hlstd{full_model} \hlkwb{=} \hlkwd{round}\hlstd{(}\hlkwd{colSums}\hlstd{(}\hlkwd{predict}\hlstd{(model1,} \hlkwc{type} \hlstd{=} \hlstr{"prob"}\hlstd{)[,}\hlnum{1}\hlopt{:}\hlnum{7}\hlstd{]),} \hlnum{0}\hlstd{)}
\hlstd{actual_counts} \hlkwb{=} \hlkwd{table}\hlstd{(daata}\hlopt{$}\hlstd{etoh)}

\hlkwd{kable}\hlstd{(}\hlkwd{rbind}\hlstd{(hx_model, full_model, actual_counts))}
\end{alltt}
\end{kframe}
\begin{tabular}{l|r|r|r|r|r|r|r}
\hline
  & 0 & 1 & 2 & 3 & 4 & 5 & 6\\
\hline
hx\_model & 8 & 10 & 11 & 9 & 6 & 3 & 1\\
\hline
full\_model & 8 & 11 & 11 & 8 & 5 & 3 & 1\\
\hline
actual\_counts & 8 & 5 & 17 & 11 & 3 & 2 & 2\\
\hline
\end{tabular}

\end{knitrout}

\vspace{5mm}

From the above table we see that both models are equally similar to the actual counts. No one model does particularly better than the other. However, when we include the other two characteristics as in the full model, we find that they have a statistically significant affect on the average number of drink a person has had in the last 24 hours (as the pvalues are greater than 0.05). Hence, they do explain the data and are a better representation of the data.

\vspace{5mm}

Secondly, since the goal of the study is to examine patient characteristics associated with self-medication through alcohol consumption. Where the characteristics are the three we have been mentioning so far. I would recommend using the model from question 2, which we have called the full model. This is because since the goal is to exam these characteristics then and since in the full model none of the characteristics appear to he superfluous then they should be inlcuded in the model. Our model also allows us to personalize the average number of drinks a person has had in the last 24 hours based on their other two characteristics. Hence, the full model represents the data better.

\vspace{5mm}

Lastly, I would not recommend using the model with only the person's history of alcohol abuse because it was obtained using stepwise forward model selection and I would highly advocate aginst using any stepwise forward model selection method. This is because using stepwise forward model selection we are doing multiple tests one after the other and then we find ourselves in the well known problem of multiple testing. Which basically is doing several statistical tests of significance at the same time or one after the other and then cherry picking the one which appears to be statistically significant (pvalue less than 0.05). One of the big problems of this is that the p-values no longer have the proper meaning and the chance of finding some test to be statistically significant just based on pure luck becomes much larger (type I error rate increases). Also, this is like cherry picking the results we want to show and not showing those we do not. It is also possible, that something which is, infact significant in explaning the model might not end up being in the model simply because of the order in which and how the variables were add to the model and we might miss very important variable because of this. Lastly, it also possible that our estimates are biased (it gives biased regression coefficients see Tibshirani [1996]).

\section*{Question 5}

The investigator is curious about the use of a hurdle model to accommodate
excess zeros. Explain the difference between hurdle and zero-inflated models.
Explain what you need to know about this study in order for you and the
investigator to decide whether the hurdle or zero-inflated model is more
appropriate for this study. [8 points]

\vspace{5mm}

{\bf Answer:}  In a hurdle model it is assumed that all the zeros come from a single source. In our example that means that all those participants that have had zero drinks in the past 24 hours comes from all the participants who are non-alcohol users or at least non-alcohol abusers. Hence, it is assumed that if you have a non-zero number of drinks you had in the past 24 hours then you have "passed the hurdle" of being a non-alcohol user. Therefore, in a hurdle model it is assumed that when one is modeling the number of zeros, one is in fact modeling the number of non-alcohol users.

\vspace{5mm}

In the zero-inflated model it is assumed that the zeros come from two different sources. The first would be those who had no choice in the first place, for example could not drink alcohol because had no access to it. We call these people not-at-risk population and the zeros coming from these people, structural zeros. The second would be those who had the option of drinking alcohol but chose, by their own will, not to drink alcohol. These people we call at-risk population and the zeros coming from this population we call sampled zeros or actual zeros. Distinguishing these two types of zeros is very important because someone who did not drink alcohol because he had no access to it, and might have had if he had access to it, is inherently very different from someone who did not drink it by chioce. If this distinction is not made then the important characteristics of those who did not drink by choice could be confounded or mixed up with the characteristics of those who did not drink simply because of a lack of access to alcohol. Zero-inflated models take into account these two different types of zero counts in the model.

\vspace{5mm}

Now, the fundamental difference between the two models is how they treat the zero counts. In hurdle model it is assumed that the zeros come from a single source (all of the zeroes are coming from the at-risk people and there are no people who are not-at-risk) and in the zero-inflated model it is assumed the zeros are produced due to two sources (at-risk people and not at rik people). Hence, to decide whether the hurdle or zero-inflated model is more appropriate for this study, we would need to identify what produces the zero counts and the type of zeros they are, i.e. if there are any structural zeros. And the main guidence to answering the question would come from looking at the design of the study so we can identify if there are any of these structural zeros.

\vspace{5mm}

Therefore, if everyone had access to alcohol and everyone drinks or does not drink alcohol (is alcoholic or not) by choice then a hurdle model would be appropriate. However, if some people did have access to alcohol while others did not, implying there are structural zeros then the zero-inflated model will be more appropriate to use. Hence, we would need to know if there are any structural zeros in the study to decide which model to use.

\end{document}


\documentclass{beamer}

\usepackage{kotex}
\usepackage{graphicx,psfrag,amsfonts,amsmath,amssymb}
\usepackage{multicol}
\usepackage{algorithm2e}

\usetheme{metropolis}
\usefonttheme[onlymath]{serif}	% 수식 설정!!
\setbeamertemplate{section in toc}[sections numbered]

\title{PC Selection for Sparse FPCA}
%\date{\today}
\date[Short Occasion]{October 1, 2019}
\author{Hyunsung Kim}
\institute{Department of Statistics\\ Chung-Ang University}

% A subtitle is optional and this may be deleted
\subtitle{}

%\author{F.~Author\inst{1} \and S.~Another\inst{2}}
% - Give the names in the same order as the appear in the paper.
% - Use the \inst{?} command only if the authors have different
%   affiliation.

%\institute[Universities of Somewhere and Elsewhere] % (optional, but mostly needed)
%{
%  \inst{1}%
%  Department of Computer Science\\
%  University of Somewhere
%  \and
%  \inst{2}%
%  Department of Theoretical Philosophy\\
%  University of Elsewhere}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

%\date{Conference Name, 2013}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
%   yourself) who are reading the slides online

\subject{Functional Data Analysis}
% This is only inserted into the PDF information catalog. Can be left
% out.

% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename}
% \logo{\pgfuseimage{university-logo}}

% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
\AtBeginSubsection[]
{
  \begin{frame}<beamer>{Outline}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}

\def \bY {\mathbf{Y}}
\def \by {\mathbf{y}}
\def \bX {\mathbf{X}}
\def \bB {\mathbf{B}}
\def \bD {\mathbf{D}}
\def \bbeta {\boldsymbol{\beta}}
\def \btheta {\boldsymbol{\theta}}
\def \bTheta {\boldsymbol{\Theta}}
\def \bepsilon {\boldsymbol{\epsilon}}
\def \balpha {\boldsymbol{\alpha}}
\def \bgamma {\boldsymbol{\gamma}}
\def \bGamma {\boldsymbol{\Gamma}}
\def \bR {\boldsymbol{R}}
\def \bZ {\boldsymbol{Z}}
\def \bG {\boldsymbol{G}}
\def \bu {\boldsymbol{u}}
\def \bV {\boldsymbol{V}}

% Let's get started
\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{Outline}
  \tableofcontents
  % You might wish to add the option [pausesections]
\end{frame}

% Section and subsections will appear in the presentation overview
% and table of contents.
\section{Methods to Choose the Number of PCs}
\begin{frame}{PVE}
	\begin{block}{PVE(Proportion of Variance Explained)}
		\vspace{0.2cm}
		$$ \begin{aligned}
			PVE_i &= \frac{\lambda_i}{\sum_{j=1}^{\infty}\lambda_j} \\
			PVE &= \frac{\sum_{j=1}^{K}\lambda_j}{\sum_{j=1}^{\infty}\lambda_j}
		\end{aligned}
		$$

		Select $K$, the number of PCs, where
		$$ PVE \ge 0.95 $$
	\end{block}
\end{frame}

\begin{frame}{Cross-Validation}
	\begin{block}{Leave-one-curve-out cross validation}
		\vspace{0.1cm}
		$$ LOOCV_i(K) = \frac{1}{N} \sum_{i=1}^N \lVert \bY_i - \widehat{\bY}_i^{-i} \lVert^2  $$
		where
		$$ \widehat{Y_i}^{-i}(t) = \hat\mu(t) + \sum_{k=1}^K \hat\phi_k^{-i}(t) \hat\xi_{ik}^{-i} $$

		Select $K$, the number of FPCs, by minimizing the $LOOCV$ error.
	\end{block}
\end{frame}

\begin{frame}{LOOCV with Squared Loss}
	\begin{figure}[h] %%% t: top, b: bottom, h: here
		\begin{center}
			\includegraphics[width=0.8\linewidth]{img/1.png}
		\end{center}
		\label{fig:long}
		\label{fig:onecol}
		\caption{Estimated MSE for 1st training data}
	\end{figure}
\end{frame}

\begin{frame}{LOOCV with Kullback–Leibler Loss(Peng and Paul, 2009)}
	\begin{figure}[h] %%% t: top, b: bottom, h: here
		\begin{center}
			\includegraphics[width=0.8\linewidth]{img/2.png}
		\end{center}
		\label{fig:long}
		\label{fig:onecol}
		\caption{Estimated Kullback–Leibler divergence for 1st training data}
	\end{figure}
\end{frame}

\section{Simulation}
\begin{frame}{Simulation}
	\begin{block}{The Procedure of the Simulation}
		\vspace{0.1cm}
		\begin{itemize}
			\item {
				Generate the $100$ datasets from the temporal gene expression data and
				split the each dataset with training and test set.
			}
			\item {
				"Sparsify" the each dataset.
			}
			\item {
				Estimate the FPC functions and scores using the sparse FPCA method with $7$ knots.
			}
			\item {
				Choose the number of FPCs satisfied $PVE \ge 0.95$
			}
			\item {
				Perform the $5$ classification methods for the training sets, and predict for the test sets with the different number of FPCs.
			}
		\end{itemize}
	\end{block}
\end{frame}

\begin{frame}{Simulation Results}
	\begin{table}[ht]
		\caption{Accuracy using FPCs selected by PVE}
		\centering
		\tiny
		\begin{tabular}{cccccccc}
			\hline
			No. \\of obs & Logistic & SVM(Linear) & SVM(Gaussian) & SVM(Sigmoid) & SVM(Poly) & K & PVE \\
			\hline
			2 & 0.645 & 0.653 & 0.623 & 0.622 & 0.607 & 3.16 & 0.92 \\
			3 & 0.783 & 0.784 & 0.745 & 0.751 & 0.739 & 3.78 & 0.94 \\
			4 & 0.848 & 0.846 & 0.800 & 0.834 & 0.803 & 4.15 & 0.97 \\
			5 & 0.899 & 0.898 & 0.857 & 0.883 & 0.856 & 4.62 & 0.98 \\
			6 & 0.894 & 0.895 & 0.854 & 0.879 & 0.859 & 4.97 & 0.99 \\
			7 & 0.915 & 0.913 & 0.879 & 0.899 & 0.879 & 4.99 & 0.99 \\
			8 & 0.910 & 0.912 & 0.876 & 0.893 & 0.885 & 5.03 & 0.99 \\
			9 & 0.916 & 0.917 & 0.880 & 0.905 & 0.894 & 5.03 & 0.99 \\
			10 & 0.917 & 0.919 & 0.884 & 0.904 & 0.886 & 5.00 & 0.99 \\
			11 & 0.922 & 0.923 & 0.887 & 0.909 & 0.892 & 5.00 & 0.99 \\
			12 & 0.921 & 0.925 & 0.889 & 0.906 & 0.891 & 5.00 & 0.99 \\
			13 & 0.919 & 0.921 & 0.888 & 0.908 & 0.892 & 5.00 & 0.99 \\
			14 & 0.922 & 0.924 & 0.891 & 0.908 & 0.892 & 5.00 & 0.99 \\
			15 & 0.921 & 0.923 & 0.886 & 0.906 & 0.894 & 5.00 & 0.99 \\
			16& 0.923 & 0.923 & 0.889 & 0.906 & 0.894 & 5.00 & 0.99 \\
			17 & 0.922 & 0.924 & 0.888 & 0.905 & 0.888 & 5.00 & 0.99 \\
			18 & 0.923 & \textcolor{red}{0.926} & 0.891 & 0.908 & 0.893 & 5.00 & 0.99 \\
			\hline
			Average & 0.888 & \textcolor{red}{0.890} & 0.853 & 0.872 & 0.855 & 4.75 & 0.98 \\
			\hline
		\end{tabular}
	\end{table}
\end{frame}

\begin{frame}{Summary of Results}
	\begin{itemize}
		\item {
			Using PVE, almost $5$ FPCs are selected.
		}
		\item {
			The selected FPCs explained about 99\% of total variability except $ N_i \le 5 $.
		}
		\item {
			The linear SVM perform well than other kernel SVM methods.
		}
		\item {
			If there are about $7$ out of $18$ observations, the model answered more than 90\% correctly.
		}
	\end{itemize}
\end{frame}

\begin{frame}{Conclusion}
	\begin{itemize}
		\item {
			LOOCV with squared loss doesn't look like the reliable method.
		}
		\item {
			Also, LOOCV's computation time is very slow, even though used parallel computing.
		}
		\item {
			LOOCV with Kullback–Leibler loss looks a better measure than squared loss, but \texttt{fpca.mle} function in \texttt{fpca} package is very unstable.
		}
		\item {
			PVE is the more useful method than LOOCV in terms of dimension reduction.
		}
	\end{itemize}
\end{frame}

\appendix
\section{Reference}
\begin{frame}
  \frametitle<presentation>{Reference}

  \begin{thebibliography}{10}
  	\beamertemplatearticlebibitems
  	\bibitem{Someone2009}
  	Peng, J. and Paul, D.
  	\newblock A Geometric Approach to Maximum Likelihood Estimation of the Functional Principal Components From Sparse Longitudinal Data
  	\newblock {\em Journal of Computational and Graphical Statistics}, 18(4):995--1015,
  	2009.

   	\beamertemplatearticlebibitems
	\bibitem{Someone2005}
		Yao, F. \textit{et al.}
		\newblock Functional data analysis for sparse longitudinal data
		\newblock {\em Journal of the American Statistical Association}, 100(470):577--590,
		2005.
  \end{thebibliography}
\end{frame}

% All of the following is optional and typically not needed.
%\appendix
%\section<presentation>*{\appendixname}
%\subsection<presentation>*{For Further Reading}
%
%\begin{frame}[allowframebreaks]
%  \frametitle<presentation>{For Further Reading}
%
%  \begin{thebibliography}{10}
%
%  \beamertemplatebookbibitems
%  % Start with overview books.
%
%  \bibitem{Author1990}
%    A.~Author.
%    \newblock {\em Handbook of Everything}.
%    \newblock Some Press, 1990.
%
%
%  \beamertemplatearticlebibitems
%  % Followed by interesting articles. Keep the list short.
%
%  \bibitem{Someone2000}
%    S.~Someone.
%    \newblock On this and that.
%    \newblock {\em Journal of This and That}, 2(1):50--100,
%    2000.
%  \end{thebibliography}
%\end{frame}

\end{document}

Sparse FPCA/Application/pc_selection/PC selection for sparse FPCA.tex