% 
% hw1.tex
%
%   This is a LaTeX template to get you started
%   making problem-set solutions
%
 
\documentclass[11pt]{article}
\usepackage{amsmath}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{-0.5in}

% *** GRAPHICS RELATED PACKAGES ***
%

\usepackage[pdftex]{graphicx}
 \graphicspath{{./}}
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
 
 \newcommand{\centerfig}[2]{%
\centerline{\includegraphics[#2]{#1}}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{\bf AI+X: Introduction to data science\\[2ex] 
       \rm\normalsize AIX0008  (Summer 2022)}
\date{\today}
\author{Patrice Koehl\\koehl@cs.ucdavis.edu}

\begin{document}
\maketitle
\section*{\underline{Homework 2 - For July 11th, 2022}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 1 \emph{(10 points)}} 

Consider a dataset of 12 numbers:

\vspace{0.05in}
$5\quad 7 \quad 4 \quad 150 \quad 5 \quad 7 \quad 3 \quad 5 \quad 5 \quad 8 \quad 100 \quad 5$

\vspace{0.05in}
\begin{itemize}
\item[a)] Find the mean and median. Which is larger?
\item[b)] Find the skew using the formula $\displaystyle \sum_{i=1}^N \frac{ (X(i)-\mu)^3}{\sigma^3}$ where $X(i)$ are the different values,
$\mu$ is the mean, $\sigma$ is the standard deviation, and the sum runs over all $N$ numbers (here $N=12$).
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 2 \emph{(10 points)}} 

A sample of 30 distance scores measured in yards has a mean of 10, a variance of 9, and a
standard deviation of 3.
\begin{itemize}
\item[a)]  You want to convert all your distances from yards to feet, so you multiply each score in the sample
by 3. What are the new mean, variance, and standard deviation?
\item[b)] You then decide that you only want to look at the distance past a certain point. Thus, after multiplying
the original scores by 3, you decide to subtract 4 feet from each of the scores. Now what are the new mean,
variance, and standard deviation?
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 3 \emph{(10 points)}} 

You recorded the time in seconds it took for 8 participants to solve a puzzle. These times
appear below. However, when the data was entered into the statistical program, the score that was supposed
to be 22.1 was entered as 21.2. You had calculated the following measures of central tendency: the mean, the
median, and the following measures of variability: the standard deviation and the variance. Which of these measures will change when you correct the recording error?

\vspace{0.05in}
$15.2\quad 18.8 \quad 19.3 \quad 19.7 \quad 20.2 \quad 21.8 \quad 22.1 \quad 29.4$

\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 4 \emph{(10 points)}} 

The table below represents the percentages of the votes cast for the Democratic candidate in the U.S. presidential years 1952-2008:

\begin{table} [h]
\begin{center}
\begin{tabular}{c c c c c}
\hline \\
Year & & California & Oregon & Washington \\
\hline \\
1952 && 42.7 & 38.9 & 44.7 \\
1956 && 44.3 & 44.8 & 45.4 \\
1960 && 49.6 & 44.7 & 45.4 \\
1964 && 59.1 & 63.7 & 62.0 \\
1968 && 44.7 & 43.8 & 47.2 \\
1972 && 41.5 & 42.3 & 38.6 \\
1976 && 47.6 & 47.6 & 46.1 \\
1980 && 35.9 & 38.7 & 37.3 \\
1984 && 41.3 & 43.7 & 42.8 \\
1988 && 47.6 & 51.3 & 50.1 \\
1992 && 46.0 & 42.5 & 45.1 \\
1996 && 51.1 & 47.2 & 49.8 \\
2000 && 53.4 & 47.0 & 50.2 \\
2004 && 54.3 & 51.3 & 52.8 \\
2008 && 61.0 & 56.7 & 57.7 \\
\hline 
\end{tabular}
\end{center}
\end{table}

Fill in the following table that provides a five-number summary for the Democrat percentages in the three states:

\begin{table} [h]
\begin{center}
\begin{tabular}{l | c | c | c  | c  | c |}
\hline \\
State &Minimum & Lower Quartile & Median & Upper Quartile & Maximum \\
\hline \\
California & & & & & \\
\hline \\
Oregon & & & & & \\
\hline \\
Washington & & & & & \\
\hline 
\end{tabular}
\end{center}
\end{table}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Exercise 5 \emph{(10 points)}} 

You encounter a problem on an exam with only answer choices: 
\begin{itemize}
\item [a)] Option 1
\item [b)]  Option 1 or Option 2
\item [c)] Option 2 or Option 3
\end{itemize}

You do not know what those options are, as the question has been omitted, but you know that only one answer (a, b, or c) is possible. Can you find that answer? Explain your reasoning.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Extra credit \emph{(5 points)}} 

You are on an island inhabited by three types of people: knights (always make true statements), knaves (always make false statements) and spies (sometimes make true statements and sometimes make false statements).  You encounter three people, A, B,  and C and you know that one is a knight, one is a knave, and one is a spy. Determine, if possible, what A, B, and C are if they address you in the way described. If you cannot determine what these three people are, can you draw any conclusions?

A says ``C is a knave"

B says ``A is the knight"

C says ``I am the spy"

\end{document}

