\documentclass[a4paper,11pt]{article}
\usepackage{assignment_style}

\newcounter{problem}
\newenvironment{problem}[1][]{%
	\refstepcounter{problem}\par \medskip
	\noindent \textbf{Problem~\theproblem.#1 \rmfamily}{\medskip}
}

\newenvironment{solution}{ \noindent \textbf{Solution: \medskip}}{}

\excludecomment{solution}

\title{WSU Economics PhD Mathematics Bootcamp \\ \vspace{2em} Assignment 2}
\date{}

\begin{document}
\maketitle

%------------------------------------
%	BEGIN ASSIGNMENT
%------------------------------------

\paragraph{Directions}
Problems 1-18 are required for assignment number 1 and are to be typed.  The remaining problems are optional.  Note: Just because material is not explicitly required on the assignment does not mean that it won't be useful or that you are not responsible for it.

Problems with a (BoP x.yz) are problems from the text \emph{Book of Proof} and should have answers at the end of the book.
Please try to avoid cheating yourself of learning by looking at the answers too soon.

I will try and find some material that could be useful for the calculus questions which are not covered in \emph{Book of Proof}.
However, using the proof methods we cover and the definition of a sequence plus your previous experience with calculus, you'll have the fundamentals you need to solve those problems.

If you need help, please feel free to email me.

\vspace{5em}

%Direct Proof

\begin{problem}
%Hammack 4.1
	\emph{Direct Proof} (BoP 4.1) If $x$ is an even integer, then $x^2$ is even.
\end{problem}

\begin{problem}
	\emph{Direct Proof} (BoP 4.13) Suppose $x,y\in \mathbb{R}$.  If $x^2 + 5y = y^2 + 5x$, then $x=y$ or $x+y=5$.
\end{problem}

%Contrapositive Proof
\begin{problem}
	\emph{Contrapositive Proof} (BoP 5.3) Suppose $a,b \in \mathbb{Z}$.  If $a^2(b^2-2b)$ is odd, then $a$ and $b$ are odd.
\end{problem}

%Contradiction
\begin{problem}
	\emph{Proof by Contradiction} (BoP 6.5) Prove that $\sqrt{3}$ is irrational.
\end{problem}

%Biconditional
\begin{problem}
	\emph{Biconditional} (BoP 7.1) Suppose $x\in \mathbb{Z}$. Then $x$ is even if and only if $3x+5$ is odd.
\end{problem}

%sets
\begin{problem}
	\emph{Sets} (BoP 8.5) If $p$ and $q$ are positive integers, then $\{pn: n \in \mathbb{N}\} \cap \{qn: n\in \mathbb{N}\} \neq \emptyset$.
\end{problem}

\begin{problem}
	\emph{Sets} (BoP 8.11) If $A$ and $B$ are sets in a universal set $U$, then $\overline{A\cup B} = \overline{A} \cap \overline{B}$.
\end{problem}

\begin{problem}
	\emph{Sets} (BoP 8.23) For each $a \in \mathbb{R}$, let $A_{a} = \{(x, a(x^2-1)) \in \mathbb{R}^2: x \in \mathbb{R}\}$.  Prove that
	\[
		\bigcap_{a \in \mathbb{R}} A_{a} = \{ (-1,0),(1,0)\}
	\]
\end{problem}

%Disproof

\begin{problem}
	[\; \textbf{Optional}](BoP 9.1) The following statement is either true or false.  If the statement is true, prove it.  If the statement is false, disprove it.
	If $x,y \in \mathbb{R}$, then $|x+y| = |x|+|y|$.
\end{problem}

Use the following definitions to help answer Problem \ref{prob:partial}.

\begin{definition}[Antisymmetric]
	A relation $R$ on a set $X$ is \textbf{antisymmetric} if $\forall x,y \in X$ such that $xRy$ and $yRx$ we have $x=y$.
\end{definition}
As an example consider the $\leq$ ordering on $\mathbb{N}$.
If for two numbers $a,b \in \mathbb{N}$ we have $a \leq b$ and $b\leq a$ then we know it must be that $a=b$.
There does not exist two distinct natural numbers that are both less than or equal to the other.
This property is important to ordering the natural numbers, real numbers, etc.
In general we can order elements of any set leading intervals and so on if the relation on that set is a \emph{partial order}.

\begin{definition}[Partial Order]
	Let $X$ be a nonempty set with relation $\preceq \subset X\times X$.  Then $\preceq$ is a \textbf{partial order} if it is reflexive, antisymmetric and transitive.
\end{definition}

\begin{problem}\label{prob:partial}
Let $C$ be a set of consumption bundles.
A \textbf{preference relation} is a binary relation, $\succsim$, where $x \succsim y$ reads $x$ \emph{is at least as good as} $y$.
We say that $\succsim$ is a \textbf{rational preference relation} if it satisfies the following properties:
\begin{enumerate}[(i)]
	\item $\forall x,y \in C, \; [x \succsim y \; \vee y \succsim x ]$ (Completeness)
	\item For $x,y,z \in C$ if $[x\succsim y \wedge y\succsim z] \implies x\succsim z$ (Transitivity)
\end{enumerate}
Use the above definitions to complete the following exercises.
\begin{enumerate}[(a)]
	\item Prove that the rational preference relation, $\succsim$, is reflexive.
	\item Defining the \textbf{indifference relation}, $\sim$, as $x \sim y$ if $[x\succsim y \wedge y \succsim x ]$, prove that $\sim$ is an equivalence relation.
	\item Define the quotient set, call it $\mathcal{I}$, associated with $(C,\sim)$ using set notation and prove that $\mathcal{I}$ is a partition of $C$.
	\item (\textbf{Optional}) Interpret the equivalence classes of $\mathcal{I}$ and show that $\succsim$ is a partial order on $\mathcal{I}$.
\end{enumerate}
\end{problem}
\begin{solution}
	\begin{enumerate}[(a)]
		\item Let $x_1,x_2 \in C$ such that $x_1 = x_2$.
		Then $x_1$ must be at least as good as $x_2$ and $x_2$ must be at least as good as $x_1$.
		Hence we have $[x_1\succsim x_2 \wedge x_2 \succsim x_2]$ and by transitivity we have $x_1 \succsim x_1$.
		Therefore for any pair $(x,x)$ we have $(x,x) \in \succsim$ \qedsymbol.
		\emph{In reality this is rather self-evident, a bundle should be at least as good as itself.  The idea is to test your knowledge of what reflexive means and trying to use the assumptions (completeness and transitivity) to show the result}.
		\item Let $\succsim$ be a rational preference relation on $C$.
		Let $x \in C$.
		Then by reflexiveness of $\succsim$ we know that $x \succsim x$ and $x \precsim x$ which implies $x \sim x$ and so the indifference relation $\sim$ is reflexive.
		Let $x,y \in C$ such that $x \sim y$.
		Then $x \succsim y \wedge y \succsim x$ which is logically equivalent to $y\succsim x \wedge x \succsim y$ which is the definition of $y \sim x$.
		Since $(x,y) \in \sim$ implies $(y,x) \in \sim$ the indifference relation $\sim$ is symmetric.
		Finally, let $x,y,z \in C$ such that $x \sim y$ and $y \sim z$.
		Then $x \succsim y \wedge y\succsim x$ and $y\succsim z \wedge z \succsim y$.
		Since both statements are true we can infer that $x \succsim y \succsim z$ is true and that $z \succsim y \succsim x$ is also true.
		By transitivity of $\succsim$ we know that $x \succsim z \wedge z \succsim x$ which is the definition of $x \sim z$.
		Hence $\sim$ is transitive.
		The indifference relation is reflexive, symmetric and transitive, therefore it is an equivalence relation. \qedsymbol
		\item Let $\sim$ be the indifference relation on the set $C$.
		We know (from part (b)) that $\sim$ is an equivalence relation.
		An equivalence class is a set of the form $[x] = \{ y \in C : x \sim y \}$ consisting of all elements $y \in C$ that are indifferent (equivalent) to  $x \in C$.
		The quotient set of $C$ \emph{modulo} the equivalence relation $\sim$ is the set of all equivalence classes $\{ [x] : x \in C\}$.
		This is a set of sets where every element of a set is ``equivalent'' or in our case indifferent to every other element in the set (think indifference curves from undergraduate micro).
		\emph{I don't know why they call it a quotient set, but it might be because its kind of like ``dividing'' the set $C$ by the equivalence relation $\sim$, resulting in a set of blocks of equivalent elements}.
		To show that the quotient set is a partition of $C$ we need to show that it is a collection of nonempty sets that are pairwise disjoint and that the union of all sets in the collection equals the set $C$.
		So let $Q = (C,\sim)$ be the quotient set of $C$ modulo $\sim$, the indifference relation.
		Let $[x] = \{ y \in C: x \sim y\}$ be an arbitrary equivalence class in $Q$.
		Then by the completeness and reflexiveness of $\succsim$ we know that $x \succsim x$ and by the reflexiveness of $\sim$ we have $x\sim x$.
		Hence, the set $[x]$ always contains $x$ and is therefore nonempty.
		Let $x,y \in C$ such that $x\neq y$ and $x \nsim y$ and let $[x]$ and $[y]$ be the respective equivalence classes.
		Now assume to the contrary that $[x]\cap [y] \neq \emptyset$ and let $z \in [x]\cap[y]$.
		Then $z \in [x] \wedge z \in [y]$ which implies that $z \sim x$ and $z \sim y$.
		By symmetry of $\sim$, we know $z \sim x \implies x \sim z$ giving us $ x \sim z \sim y$ and by transitivity of $\sim$ this implies that $x \sim y$ which is a contradiction since we assumed $x \nsim y$.
		Finally we want to show that $\cup_{x \in C} [x] = C$.
		Let $z \in \cup_{x\in C}[x]$.
		Then $z \in [x] = \{ y \in C: x \sim y\}$ for some $x \in C$ and clearly $z \in C$.
		Now Let $z \in C$.
		Then $z \in [z] = \{ y \in C: z \sim y \}$ where $[z] \in \{ [x]: x \in C\}$.
		Hence $z \in \cup_{x \in C}[x]$.
		This implies that $\cup_{x\in C}[x] \subset C$ and $C \subset \cup_{x\in C}[x]$ and therefore $\cup_{x \in C}[x] = C$. \qedsymbol
		\item The equivalence classes of $\mathcal{I} = \{[x]: x \in C\}$ constitute the indifference sets of a rational preference relation $\succsim$.
		When combined with a utility function they will be indifference curves.
		The rational preference relation $\succsim$ is what is known as a total pre-order.
		It gives us a basic notion of greater than and less than.
		For example if $x$ is at least as good as $y$ we are in a way saying that $x$ is no less than $y$.
		Furthermore, if we were to say $x\succsim y$ and $y \nsuccsim x$ then we could use a symbol like $x \succ y$ implying that $x$ is at least as good as $y$ but that $y$ is NOT at least as good as $x$.
		We could rephrase this as $x$ \emph{is preferred to} $y$ which essentially ranks $x$ as ``greater than'' $y$ in terms of preference.
		So now consider how the preferences $\succsim$ ``rank'' the indifference sets in the quotient set $\mathcal{I}$.

		Consider $[x]$ and $[y]$ such that $x \nsim y$.
		Then for any $x_0 \in [x]$ and any $y_0 \in [y]$ we know it must be that $x_0 \nsim y_0$.
		Hence we have either $x_0 \succ y_0$ or $y_0 \succ x_0$.
		So if we consider the Cartesian product $\mathcal{I}\times \mathcal{I}$ then we say $[x] \succsim [y]$ if $x \succsim y$.
		Notice that if this is true for $(x,y)$ then it will be true for some other pair $(x_0,y_0)$ when $x_0 \in [x]$ and $y_0 \in [y]$.
		A binary relation, like $\succsim$ is a partial order if it is reflexive, transitive and \emph{antisymmetric}.
		For the reflexive property note that $[x] \succsim [x]$ since every element of $x_0 \in [x]$ has the property $x\sim x$ since $x \succsim x$.
		For transitivity let $[x],[y],[z]$ be in $\mathcal{I}$ such that $[x]\succsim [y]$ and $[y]\succsim [z]$.
		Then for all $x_0 \in [x]$ and $y_0 \in [y]$ we know $x_0 \succsim y_0$ and for all $z_0 \in [z]$ we have $y_0 \succsim z_0$.
		Hence by transitivity of $\succsim$ on $C$ we have $x_0 \succsim z_0$.
		Since every element of $[x]$ is equivalent to $x_0$, every element of $[y]$ is equivalent to $y_0$ and every element of $[z]$ is equivalent to $z_0$ this holds for any elements of theses sets and we have $[x]\succsim [y] \succsim [z]$ implying $[x] \succsim [z]$ so the relation is transitive.
		Finally consider $[x] \succsim [y]$ and $[y]\succsim [x]$.
		This implies that $x \sim y$ which implies $y \sim x$.
		By transitivity if $x \sim y$ then $x \sim y_0$ for any $y_0 \in [y]$.
		By symmetry if $y \sim x$ then $y \sim x_0$ for any $x_0 \in [x]$.
		Hence every element of $[x]$ is indifferent (equivalent) to every element of $[y]$.
		Based on the definition of equivalence classes this is only possible if $[x]=[y]$.
		Since $[x]\succsim [y] \wedge [y]\succsim [x] \implies [x]=[y]$ the relation is antisymmetric.
		The relation is reflexive, transitive and antisymmetric on $\mathcal{I}$, therefore it is a partial order on $\mathcal{I}$.
	\end{enumerate}
\end{solution}

%function
\begin{problem}
	(BoP 12.2.13) Consider the function $f:\mathbb{R}^2 \rightarrow \mathbb{R}^2$ defined as $f(x,y) = (xy,x^3)$.  Is $f$ injective? Is it surjective? Bijective? Explain.
\end{problem}

\begin{problem}
	Let $f$ be a function from $A$ to $B$ and let $E$, $F \subset A$.
	Prove statements $a$ through $e$.
	\begin{enumerate}[(a)]
		\item If $E\subset F$, then $f(E) \subset f(F)$,
		\item $f(E\cap F) \subset f(E)\cap f(F)$,
		\item $f(E\cup F) = f(E) \cup f(F)$,
		\item $f(E-F) \subset f(E)$
	\end{enumerate}
\end{problem}
\begin{solution}
	\begin{enumerate}[(a)]
		\item Let $E \subset F$ and $y \in f(E) = \{ f(x): x \in E\}$.
		Then $\exists x \in E$ such that $y = f(x)$.
		Since $E \subset F$ we know $x \in F$ which implies that $f(x) \in f(F)$.
		But $f(x) = y$ so $y \in f(F)$ therefore $f(E) \subset f(F)$.\qedsymbol
		\item Let $y \in f(E \cap F) = \{ f(x) : x \in E \wedge x \in F\}$.
		Then $\exists x \in E \cap F$ such that $y = f(x)$.
		Hence $f(x) \in f(E)$ and $f(x) \in f(F)$.
		But $y= f(x)$ so $y\in f(E)$ and $y \in f(F)$ so $y \in f(E)\cap f(F)$.
		Therefore $f(E \cap F) \subset f(E) \cap f(F)$.\qedsymbol
		\item ($\Rightarrow$)Let $y \in f(E\cup F) = \{ f(x): x \in E \vee x \in F\}$.
		Then $\exists x \in E \cup F$ such that $y = f(x)$.
		Furthermore, $x \in E \cup F$ implies that $x$ is in either $E$ and not $F$, $F$ and not $E$ or in both $E$ and $F$.
		If $x \in E$ then $f(x) \in f(E)$.
		If $x \in F$ then $f(x) \in f(F)$.
		Because one or both are true, $f(x) \in f(E)\cup f(F)$.
		But $y = f(x)$ so $y \in f(E)\cup f(F)$.

		($\Leftarrow$) Now let $y \in f(E)\cup f(F)$.
		Then $y \in f(E) \vee y \in f(F)$.
		Then $\exists x \in E \cup F$ such that $y = f(x)$.
		But $x \in E \cup F$ implies $f(x) \in f(E \cup F)$ and $y = f(x)$ so $y \in f(E \cup F)$.
		Therefore $f(E \cup F) \subset f(E)\cup f(F)$ and $f(E) \cup f(F) \subset f(E\cup F)$ which gives the result $f(E\cup F) = f(E)\cup f(F)$.\qedsymbol
		\item Let $y \in f(E-F)$.
		Then $\exists x \in E-F$ such that $y = f(x)$.
		Since $E-F = \{ z \in A: z \in E \wedge z \notin F\}$ we know that $x \in E$ which means $f(x) \in f(E)$.
		But $y = f(x)$ so $y \in f(E)$ and therefore $f(E-F)\subset f(E)$. \qedsymbol
	\end{enumerate}
\end{solution}

\begin{problem}
	\textbf{(Level sets of functions)} Let $f:A \rightarrow B$ be a function.
	Define a relation on $A$ denoted $a \sim_f a'$ if $\exists b \in B$ such that $a,a' \in f^{-1}(b)$.
	Prove the following statements.
	\begin{enumerate}[(a)]
		\item Show that $\sim_f$ is an equivalence relation on $A$.
		\item Show that $[a \sim_f a'] \iff [f(a) = f(a')]$.
		\item Prove that the inverse images $f^{-1}(b)$ and $f^{-1}(b')$ are disjoint when $b\neq b'$. (This means that indifference curves never intersect.)
	\end{enumerate}
\end{problem}
\begin{solution}
	\begin{enumerate}[(a)]
		\item Let $a \in A$ and $b = f(a)$.
		Then for the pair $(a,a)$ clearly $a \sim_f a$ since $a \in f^{-1}(b)$ and so $\sim_f$ is reflexive.
		Let $a \sim_f a'$.
		Then $\exists b \in B$ such that $f(a)=f(a')=b$.
		Hence $a,a' \in f^{-1}(b)$ and $(a,a')\in \sim_f \implies (a',a) \in \sim_f$ and $\sim_f$ is symmetric.
		Finally let $a,a',a'' \in A$ such that $a \sim_f a'$ and $a' \sim_f a''$.
		Then $\exists b \in B$ such that $a,a'\in f^{-1}(b)$ and $\exists b' \in B$ such that $a',a'' \in f^{-1}(b')$.
		By definition, functions can only map elements of $A$ into exactly one element in $B$.
		Hence if $f(a')=b$ and $f(a') = b'$ it must be that $b = b'$.
		But this implies that $f(a)=f(a')=f(a'')$ and so $a,a',a'' \in f^{-1}(b)$ and hence $\exists b \in B$ such that $a,a'' \in f^{-1}(b)$ and therefore $a \sim_f a''$ so the relation is transitive.
		Since the relation $\sim_f$ is reflexive, symmetric and transitive it is an equivalence relation.\qedsymbol
		\item ($\Rightarrow$) Let $a \sim_f a$. Then $\exists b \in B$ such that $a,a' \in f^{-1}(b) = \{ a \in A : f(a)=b\}$.
		Hence we have $f(a)=b \wedge f(a')=b$ and therefore $f(a)=f(a')$.

		($\Leftarrow$) Let $a',a'' \in A$ such that $f(a')=f(a'')$.  Furthermore let $b \in B$ be the element $b = f(a')=f(a'')$.
		Then $a',a'' \in \{ a \in A : f(a) = b\} = f^{-1}(b)$.
		Hence $\exists b \in B$ such that $a',a'' \in f^{-1}(b)$ and therefore $a' \sim_f a''$. \qedsymbol
		\item Let $b,b' \in B$ such that $b \neq b'$ and consider the sets $f^{-1}(b)$ and $f^{-1}(b')$ and assume to the contrary that $f^{-1}(b) \cap f^{-1}(b') \neq \emptyset$.
		Then there exist elements in $f^{-1}(b) \cap f^{-1}(b')$ and let $a \in f^{-1}(b) \cap f^{-1}(b')$.
		Then $a \in f^{-1}(b) \wedge a \in f^{-1}(b')$ which implies $f(a)=b \wedge f(a)=b'$.
		Since the definition of a function requires that $\forall a \in A, \exists ! b \in B$ such that $b=f(a)$ it must be that $b=b'$ which is a contradiction, implying that $f^{-1}(b) \cap f^{-1}(b') = \emptyset$ when $b \neq b'$. \qedsymbol
		(FYI, the compound symbol $\exists !$ means ``there exists a unique'')
	\end{enumerate}
\end{solution}

\begin{problem}
	Prove the following statements.
	Let $f$ be a function mapping $A$ to $B$, and let $G$, $H \subset B$.
	(Reminder: the notation here $f^{-1}(X)$ is the \emph{pre-image} of some set $X$ in the codomain under the function $f$.)
	\begin{enumerate}[(a)]
		\item If $G\subset H$, then $f^{-1}(G) \subset f^{-1}(H)$,
		\item $f^{-1}(G\cap H) = f^{-1}(G) \cap f^{-1}(H)$,
		\item $f^{-1}(G\cup H) = f^{-1}(G) \cup f^{-1}(H)$, and
		\item $f^{-1}(G - H) = f^{-1}(G) - f^{-1}(H)$.
	\end{enumerate}
\end{problem}
\begin{solution}
	\begin{enumerate}[(a)]
		\item Let $G \subset H \subset B$ and $a \in f^{-1}(G) \subset A$.
		Then $f(a) \in G$ and since $G \subset H$ we know $f(a) \in H$.
		Hence, $a \in f^{-1}(H)$ and therefore $f^{-1}(G) \subset f^{-1}(H)$. \qedsymbol
		\item ($\Rightarrow$) Let $a \in f^{-1}(G \cap H)$.
		Then $f(a) \in G \cap H$ which is equivalent to $f(a) \in G \wedge f(a) \in H$.
		But this implies that $a \in f^{-1}(G) \wedge a \in f^{-1}(H)$ which is equivalent to $a \in f^{-1}(G)\cap f^{-1}(H)$.
		Therefore $f^{-1}(G \cap H) \subset f^{-1}(G)\cap f^{-1}(H)$.

		($\Leftarrow$) Let $a \in f^{-1}(G) \cap f^{-1}(H)$.
		Then $a \in f^{-1}(G) \wedge a \in f^{-1}(H)$ which implies $f(a) \in G \wedge f(a) \in H \equiv f(a) \in G \cap H$.
		Since $f(a) \in G \cap H$ implies $a \in f^{-1}(G \cap H)$ we have $f^{-1}(G)\cap f^{_1}(H) \subset f^{-1}(G \cap H)$.
		Therefore $f^{-1}(G\cap H) = f^{-1}(G)\cap f^{-1}(H)$.
		\item ($\Rightarrow$) Let $a \in f^{-1}(G \cup H)$.
		Then $f(a) \in G \cup H \equiv f(a) \in G \vee f(a) \in H$.
		If $f(a) \in G$, then $a \in f^{-1}(G)$ and if $f(a) \in H$, then $a \in f^{-1}(H)$.
		Hence $f(a) \in G \vee f(a) \in H$ implies $a \in f^{-1}(G) \vee a \in f^{-1}(H)$ which is equivalent to $a \in f^{-1}(G) \cup f^{-1}(H)$.

		($\Leftarrow$) Let $a \in f^{-1}(G) \cup f^{-1}(H)$.
		Then $a \in f^{-1}(G) \vee a \in f^{-1}(H)$.
		If $a \in f^{-1}(G)$ then $f(a) \in G$.
		If $a \in f^{-1}(H)$ then $f(a) \in H$.
		Hence $a \in f^{-1}(G) \vee a \in f^{-1}(H)$ implies $f(a) \in G \vee f(a) \in H \equiv f(a) \in G \cup H$.
		But $f(a) \in G \cup H$ implies $a \in f^{-1}(G \cup H)$.
		Therefore $f^{-1}(G \cup H) = f^{-1}(G) \cup f^{-1}(H)$. \qedsymbol
		\item ($\Rightarrow$) Let $a \in f^{-1}(G - H)$.
		Then $f(a) \in G \wedge f(a) \notin H$ which implies that $a \in f^{-1}(G) \wedge a \notin f^{-1}(H)$.
		Therefore $a \in f^{-1}(G) - f^{-1}(H)$.

		($\Leftarrow$) Let $a \in f^{-1}(G) - f^{-1}(H)$.
		Then $a \in f^{-1}(G) \wedge a \notin f^{-1}(H)$ which implies $f(a) \in G \wedge f(a) \notin H$.
		Hence we have $f(a) \in G \cap (B - H) = (G \cap B) - H = G - H$.
		Since $f(a) \in G - H$ we know $a \in f^{-1}(G - H)$.
		Therefore $f^{-1}(G-H) = f^{-1}(G) - f^{-1}(H)$. \qedsymbol
	\end{enumerate}
\end{solution}

%Calculus
\begin{problem}
%Chartrand 12.7
A \textbf{sequence} in $A$ is a function $f: \mathbb{N} \rightarrow A$ and the range of the sequence is a list $\{f(1),f(2),\dots \} = \{a_1, a_2, \dots \}$.
By definition $\lim_{n\rightarrow \infty} a_n = L$ if for every positive real number (no matter how small) $\epsilon > 0$, there exists a positive integer $N$ such that if $n$ is an integer with $n > N$, then $|a_n - L| < \epsilon$.
By taking the negation of this definition, write out the meaning of $\lim_{n\rightarrow \infty} a_n \neq L$ using quantifiers.  Then write out the meaning of $\{a_n\}$ diverges using quantifiers.

\noindent (Hint: the definition of convergence using quantifiers is: $(\forall \epsilon > 0), \exists N \in \mathbb{N}, \forall n > N, |a_n - L| < \epsilon$.  Or in terms of an implication $\forall \epsilon > 0, \exists N \in \mathbb{N}, \; [ n > N \implies |a_n - L| < \epsilon ]$)
\end{problem}
\begin{solution}
	\textbf{Negation}: There exists a real number $\epsilon > 0$ such that for each positive integer $N$, there exists an integer $n > N$ such that $|a_n - L| \geq \epsilon$.
	\textbf{Divergence}: For each real number $L$, there exists $\epsilon > 0$ such that for each positive integer $N$, there exists $n > N$ such that $|a_n - L | \geq \epsilon$.
	\textbf{Symbolic}: $\exists \epsilon > 0, \; \forall N \in \mathbb{N}, \; \exists n \in \mathbb{N}, n > N, \; |a_n - L| \geq \epsilon$.
	\emph{Notice the difference between negation and divergence. The definition of convergence included as specific limit $L$.  Negation just says that the sequence doesn't converge to $L$, but may still converge to some other $L' \neq L$.  Divergence on the other hand says there does not exist any limit $L$ that the sequence converges to (note: but there may be a subsequence that does -- see real analysis).}
\end{solution}

\begin{problem}
%Chartrand 12.3
	Using the definition of convergence in the previous problem, prove that the sequence $\left\{ \frac{1}{2n} \right\}$ converges to 0.
\end{problem}
\begin{solution}
	Let $\epsilon > 0$ be given.
	Choose $N = \lceil 1/(2\epsilon) \rceil$ where $\lceil 1/(2\epsilon) \rceil$ represents the ``ceiling'' integer of $1/(2\epsilon)$ (essentially round it up to the nearest integer).
	Now let $n > N$.
	Thus $n > 1/(2\epsilon)$ and so $|\frac{1}{2n} - 0| = \frac{1}{2n} < \frac{1}{2N} < \frac{1}{2(1/(2\epsilon)} = \frac{1}{1/\epsilon} = \epsilon$. \qedsymbol
\end{solution}

\begin{definition}[Limit of a Function]
	Let $f$ be a real-valued function defined on a set $X$ of real numbers.
	We say $L \in \mathbb{R}$ is the \textbf{limit} of $f(x)$ as $x$ approaches $a \in \mathbb{R}$ if for every real number $\epsilon > 0$, there exists a real number $\delta > 0$ such that for every real number $x$ with $0 < |x-a| < \delta$, it follows that $|f(x) - L| < \epsilon$.

	( $\forall \epsilon > 0, \exists \delta > 0, \forall x \; [ |x-a| < \delta ] \implies [ |f(x)-L| < \epsilon ]$)
\end{definition}

\begin{definition}[Epsilon Neighborhood]
	Let $a\in \mathbb{R}$ and $\epsilon > 0$.
	Then the set (interval) defined as $B_{\epsilon}(a) = \{ x \in \mathbb{R} : |x-a| < \epsilon \} = (a - \epsilon, a + \epsilon)$ is called an $\epsilon$-\textbf{neighborhood} (or epsilon-ball) of $a$.
\end{definition}

The above definition is very important and you will see this used a lot in the future.
We can use it to restate the definitions of limits used earlier.

We say the sequence $\{a_n\}$ converges to the limit $L$ if
\[
	\forall \epsilon > 0, \exists N \in \mathbb{N} \text{ such that } \forall n > N, \; a_n \in B_{\epsilon}(L)
\]
Similarly for the limit of a function, we say that the limit of the function $f$ over sequence $\{a_n\}$ is $L$ if
\[
	\forall \epsilon > 0, \exists \delta > 0 \text{ such that } x \in B_{\delta}(L) \implies f(x) \in B_{\epsilon}(L)
\]

\begin{definition}[Continuity]
	Let $f:X \rightarrow \mathbb{R}$.
	We say that $f$ is \textbf{continuous} at a point $\a in \mathbb{R}$ if $\lim_{x\rightarrow a} f(x) = f(a)$.
	Using our previous methods of defining limits this means we can phrase continuity also as
	\begin{align}
		\forall \epsilon > 0, \exists \delta > 0, \forall x &\text{ such that } |x - a| < \delta , [f(x) - f(a) < \epsilon] \nonumber \\
		\forall \epsilon > 0, \exists \delta > 0, &\text{ such that } x \in B_{\delta}(a) \implies f(x) \in B_{\epsilon}(f(a)) \nonumber
	\end{align}
\end{definition}
In general there are three criteria for $f$ to be continuous at point $a$.
\begin{enumerate}[(i)]
	\item $f$ is defined at $a$
	\item $\lim_{x \rightarrow a} f(x)$ exists
	\item $\lim_{x \rightarrow a} f(x) = f(a)$
\end{enumerate}

\begin{problem}
%Chartrand 12.39
	Prove that the function $f:[1,\infty) \rightarrow [0,\infty)$ defined by $f(x) = \sqrt{x-1}$ is continuous at $x=10$.
\end{problem}
\begin{solution}
(From Chartrand 12.39)
	Let $\epsilon > 0$ be given and choose $\delta = \min(1,5\epsilon)$.
	Let $x \in \mathbb{R}^n$ such that $0 < | x - 10 | < \delta$.
	Since $| x - 10 | < 1$, it follows that $9 < x < 11$ and so $\sqrt{x - 1} + 3 > 5$.
	Therefore, $1/(\sqrt{x-1}+3) < 1/5$.
	Hence
	\[
		|\sqrt{x-1}-3| = \left| \frac{(\sqrt{x-1}-3)(\sqrt{x-1}+3)}{\sqrt{x-1} + 3} \right| = \frac{|x-10|}{\sqrt{x-1}+3} < \frac{1}{5}(5\epsilon) = \epsilon
	\]
	which completes the proof. \qedsymbol
\end{solution}

\begin{problem}
%Chartrand 12.41
	Let $f:\mathbb{R} \rightarrow \mathbb{R}$.
	We say the function $f$ is \textbf{differentiable} at $a$ and is denoted $f'(a)$ if the following limit exists.
	\[
		f'(a) = \lim_{x\rightarrow a} \frac{f(x)-f(a)}{x-a}
	\]
\end{problem}
Let $f$ be defined as $f(x) = x^2$.
Determine $f'(3)$ and verify that your answer is correct with an $\epsilon-\delta$ proof.

\begin{solution}
	(From Chartrand 12.41)
	$f'(3) = 6$.

	\textit{Proof}. \; Let $\epsilon > 0$ be given and choose $\delta = \epsilon$.
	Let $x \in \mathbb{R}$ such that $0 < |x - 3| < \delta = \epsilon$.
	Then
	\begin{align}
		\left| \frac{f(x)-f(3)}{x-3} - 6\right| &= \left| \frac{x^2-9}{x-3} - 6 \right| = \left| \frac{(x-3)(x+3)}{x-3}-6 \right| \nonumber \\
		&= |(x+3)-6| = |x - 3| < \epsilon \nonumber
	\end{align}
	Thus, $f'(3) = 6$. \qedsymbol
\end{solution}

%------------------------------------
%	END ASSIGNMENT
%------------------------------------

%------------------------------------
%	EXTRA PRACTICE EXERCISES
%------------------------------------

\newpage
\section{Extra Practice Exercises}

\subsection{Direct Proof}

\begin{problem}
	(BoP 4.9) Suppose $a$ is an integer.  If $7\; |\; 4a$ then $7\; |\; a$.
\end{problem}

\subsection{Contrapositive Proof}

Prove the following using the method of contrapositive proof.

\begin{problem}
	(BoP 5.9) Suppose $n \in \mathbb{Z}$. If $3 \nmid n^2$, then $3 \nmid n$.
\end{problem}

\subsection{Either Direct or Contrapositive Proof}
Use either direct or the contrapositive method to prove the statements.

\begin{problem}
	(BoP 5.15) Suppose $x\in \mathbb{Z}$.  If $x^3-1$ is even, then $x$ is odd.
\end{problem}

\begin{problem}
(BoP 5.21) Let $a,b \in \mathbb{Z}$ and $n\in \mathbb{N}$.  If $a\equiv b (\mod n)$, then $a^3 \equiv c^3 (\mod n)$.
\end{problem}

\subsection{Proof by Contradiction}

Use the method of proof by contradiction to prove the following statements.

\begin{problem}
	(BoP 6.11) There exist no integers $a$ and $b$ for which $18a + 6b = 1$.
\end{problem}

\subsection{Proving Non-conditional Statements}

\begin{problem}
	(BoP 7.1) Suppose $x\in \mathbb{Z}$. Then $x$ is even if and only if $3x+5$ is odd.
\end{problem}

\begin{problem}
	(BoP 7.21) Every real solution of $x^3 + x + 3 = 0$ is irrational.
\end{problem}

\subsection{Proofs Involving Sets}
\emph{Book of Proof} Chapter 8 Exercises: 1,5,7,9,11,21,23
Use any of the methods we've covered to prove the following statements.
\begin{problem}
	(BoP 8.1) Prove that $\{12n: n\in \mathbb{Z}\} \subseteq \{2n: n\in \mathbb{Z}\} \cap \{3n: n\in \mathbb{Z}\}$.
\end{problem}

\begin{problem}
	(BoP 8.9) If $A$,$B$ and $C$ are sets, then $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$.
\end{problem}

\begin{problem}
	(BoP 8.21) Suppose $A$ and $B$ are sets. Prove $A \subseteq B$ if and only if $A-B = \emptyset$.
\end{problem}

\subsection{Disproof}
Each of the following statements is either true or false.  If a statement is true, prove it.  If a statement is false, disprove it.

\begin{problem}
	(BoP 9.34) If $X \subseteq A \cup B$, then $X \subseteq A$ or $X \subseteq B$.
\end{problem}

\subsection{Relations}

\begin{problem}
	(BoP 11.0.1) Let $A =\{0,1,2,3,4,5\}$.  Write out the relation $R$ that expresses $>$ on $A$.
\end{problem}

\begin{problem}
	(BoP 11.1.6) Consider the relation $R = \{(x,x): x \in \mathbb{Z}\}$ on $\mathbb{Z}$.
	Is $R$ reflexive? Symmetric? Transitive?  If a property does not hold, say why.  What familiar relation is this?
\end{problem}

\begin{problem}
	(BoP 11.1.8) Define a relation on $\mathbb{Z}$ as $xRy$ if $|x-y| < 1$.
	Is $R$ reflexive? Symmetric? Transitive?  If a property does not hold, say why.  What familiar relation is this?
\end{problem}

\subsection{Functions}

\begin{problem}
	(BoP 12.1.7) Consider the set $\{(x,y) \in \mathbb{Z}\times \mathbb{Z}: 3x+y=4\}$.  Is this a function from $\mathbb{Z}$ to $\mathbb{Z}$? Explain.
\end{problem}

\begin{problem}
	(BoP 12.1.9) Consider the set $f = \{(x^2,x): x\in \mathbb{R}\}$. Is this a function from $\mathbb{R}$ to $\mathbb{R}$? Explain.
\end{problem}

\begin{problem}
	(BoP 12.2.5) A function $f: \mathbb{Z} \rightarrow \mathbb{Z}$ defined as $f(n) = 2n + 1$.
	Verify whether this function is injective and whether it is surjective.
\end{problem}

\begin{problem}
	(BoP 12.5.7) Show that the function $f:\mathbb{R}^2 \rightarrow \mathbb{R}^2$ defined by the formula $f(x,y) = ((x^2+1)y, x^3)$ is bijective.  Then find its inverse.
\end{problem}

\subsection{Calculus Topics}

\begin{problem}
%Chartrand 12.11
	Prove that if a sequence $\{s_n\}$ converges to $L$, then the sequence $\{s_{n^2}\}$ also converges to $L$.
\end{problem}

\begin{problem}
%Chartrand 12.19
	Give an $\epsilon - \delta$ proof that $\lim_{x\rightarrow -1} (3x-5) = -8$.
\end{problem}

\begin{problem}
%Chartrand 12.25
	Show that $\lim_{x\rightarrow 0} \frac{1}{x^2}$ does not exist.
\end{problem}

\end{document}


\section{Intermediate Representation}

Here begins the code optimization part. The compiler pipe line begins with source code which is unoptimized, having specifications of the program logic by human programmer.On the other end of the pipeline, we have assembly code which actually gets executed on machine. The question we want to address here is: where to do the optimization? Here are three different options along with their pros and cons:

\begin{itemize}
    \item \textbf{Optimize at source code level} : For e.g, we can run optimization on  the abstract syntax tree(AST) of the programming language. But then, we will have to deal with a lot of features which are very specific to a programming language. For e.g., C has \emph{for} and \emph{while} loops but optimization does not care whether loops are written using \emph{for} or \emph{while}, it just needs to know that there is a loop.
    Also, sometimes we need information about the architecture to do architecture specific optimizations but if we do the optimization at source code level, we do not have visibility into the architecture.
    \item \textbf{Optimize at assembly language}: This level has much less features, usually nothing specific to any programming language. But here the optimization space is very limited because most of the decisions are already taken by the time we reach the assembly code.
    \item \textbf{Optimize the intermediate representation(IR)} : Most compilers have intermediate representation(IR). The AST is translated to IR and then optimized IR is converted to assembly code.
    What is a good intermediate representation? The IR should be simple enough, should not have unnecessary program features(e.g., \emph{for} vs \emph{while} loop differentiation). Also we want to make minimum commitments when designing IR so that we have large optimization space.
    Essentially there is a tradeoff in designing the IR:
    \begin{itemize}
        \item IR too close to assembly - there is smaller optimization space
        \item IR too close to source - loose architecture specification optimizations.
    \end{itemize}

\end{itemize}

\textbf{More Software Engineering advantages of IR:}

We can have $n$ number of source code languages on the source code side and  similarly, we can have $m$ number of instruction set architectures(ISA) like x86 etc on the architecture side. If we write one IR that can serve both different source code languages and architectures, then we just need to write optimizers once for that IR. We won't have to write different optimizers for each language or each ISA.
But then there is one more issue here: The types of constructs needed to support C(lower level language than python) program are different from the type of constructs needed to support python program. IR design can be considered more art than science and is constantly evolving.

In reality, its difficult to design one IR, so there are multiple IRs -(in the range of 3-5). Each IR has its own level of abstraction. Each level will have different optimizations, because different types of optimizations require different abstractions. This can be explained with an example:
Consider \emph{Tensorflow} :
\begin{itemize}
    \item In \emph{Tensorflow}, source program is represented as graph.
    \item Nodes are operators. Edges represent data flow.
    \item Datatypes are tensors(multi-Dimensional arrays).
\end{itemize}

Some example optimizations are:
\begin{itemize}
    \item  \textbf{Matrix level rewrites} : $A*A^{-1} = I$. (For this, we need to know that $A$ is a matrix and $*$ is multiplication operation). Such operations are easier closer to the source code because by the time we reach assembly code, we lose track of this high level information.
    \item \textbf{Parallelization operation}:  This needs dependency information which is in the form of matrices, so better to do this optimization at higher level than lower level.
    \item \textbf{Locality} : There is fixed size architecture, we need to organize data so that the cache is maximum utilized. Optimizations like these are done in higher level IRs.
    \item \textbf{Register Allocation} : These need to be done at lower level of abstractions, so these are done at lower level IRs.
\end{itemize}


\documentclass[12pt]{econtex}
\usepackage{econtexSetup}
\usepackage{econtexShortcuts}

\usepackage{cancel}

\begin{document}

\title{Suggested Naming Conventions in ARK}

\forcedate{July 15, 2018}

\vspace{2in}

\keywords{ARK, Variable, Function, Object, Operator, Naming, Guidelines, Conventions}
\jelclass{None}

\maketitle

\begin{abstract}
  Sharing of code is easier when different contributors use similar names for similar objects.  While we will not enforce the
  recommendations below, contributors can make their code more attractive to others
  by using names consistent with our guidelines.
\end{abstract}

\thanks{The \texttt{NARK} repo that generates this document
also contains \LaTeX~configuration files that permit you to use the same name for an object in
your writing (your \texttt{paper.tex} file) and in your code (helping to minimize confusion in translating between paper and code).}

\pagebreak

\section{Principles}
Our aim has been to balance:
\begin{itemize}
\item Brevity (nobody wants to type long names over and over)
\item Uniqueness (in case you want to search-and-replace)
\item Mnemonic quality (it should be easy to remember what represents what)
\item Ubiquity (objects defined herein will appear in many projects)
\item Combinatoriality (easy to mix and match our recommendations)
\end{itemize}

\pagebreak

\section{Variables}

\subsection{Single-Letter}

We generally discourage the use of single-letter variable names.  The reasons for this advice are presented \textit{ad nauseum} in introductory computer programming texts (which, we know, few economists consult); here we will note only that the extent to which your code will be influential depends upon the extent to which someone else can easily read it, which is harder if you have used variable names which could mean almost anything.

It is only slightly less objectionable to name a variable after a familiar letter in another commonly used alphabet (say, \texttt{delta}).  Your future self (and other users) will not know which of the many possible meanings of $\delta$ you had in mind.

But, because brevity is a virtue, a single letter \textit{in combination with a modifier or two} (`\texttt{hMin}' as the value of minimum human wealth, say) is fine -- so long as the reader has some reason to expect that the lower-case letter \texttt{h} signifies human wealth (as they will, if they consult Table~\ref{table:RomanLetters}).

That is the spirit in which we offer preferred interpretations for the Roman letters below.  The upper case version is an aggregated version of the variable (at the level of the whole economy, say, or of the whole market being studied), while the lower case indicates the level of an individual consumer or firm or other subaggregate entity.

A few exceptions to these rules are explicitly noted below the table.

When an alternative is needed with a meaning similar to, but distinct from, the definitions below, please use a multi-letter name to represent it.  For example, please do not use $W$ for wealth (if some measure of wealth that differs from $\ALev$, $\BLev$, $\HLev$, or $\NLev$ is needed); instead use, say, \texttt{Wlth} or \texttt{Wealth}.  (Some examples follow in a subsequent section).

Finally, a few of the definitions below are actually prohibitions; these are based on many years of experience which have shown that use of the prohibited variable name generates more confusion than clarity.

\begin{table}[h]
\begin{center}
\begin{tabular}{|lcl|}   \hline
Letter & & Meaning
\\ \hline
    \ALev & & \textit{A}ssets \textit{A}fter \textit{A}ll \textit{A}ctions have been \textit{A}ccomplished (end of period)
\\  \BLev & & \textit{B}eginning \textit{B}ank \textit{B}alances \textit{B}efore any \textit{B}ehavior (\textit{b}eginning-of-period)
\\  \CLev & & \textit{C}onsumption \textit{C}hoice \textit{C}onnects $B$ to $A$
\\  \DLev & & \textit{D}ebt
\\  \ELev & & PROHIBITED:  Too many possible meanings (expectations, effort, expenses)
\\  \FLev & & Production \textit{F}unction
\\  \GLev & & \textit{G}rowth
\\  \HLev & & \textit{H}uman wealth
\\  \ILev & & \textit{I}nvestment
\\  \JLev & & Ad\textit{J}ustment costs (e.g., in a $Q$ model)
\\  \KLev & & Capital or beginning of period nonhuman assets
\\  \LLev & & PROHIBITED: Is it Labor or Leisure or Land or ...?
\\  \MLev & & \textit{M}arket resources (the sum of capital, capital income, and labor income)
\\  \NLev & & \textit{N}et wealth including human wealth ($=B + H$)
\\  \OLev & & PROHIBITED: Too similar to the number 0; too many possible meanings
\\  \PLev & & PROHIBITED: Is it prices, permanent income, present value, profits, ...?
\\  \QLev & & Hayashi/Abel $Q$ (or similar asset price)
\\  \RLev & & \textit{R}eturn (see the variants articulated below)
\\  \SLev & & PROHIBITED: ``saving'' (flow)? ``savings'' (stock)? or the ``saving rate'' (ratio)?
\\  \TLev & & This is a tough one.  See the discussion below.
\\  \ULev & & \textit{U}tility
\\  \VLev & & \textit{V}alue
\\  \WLev & & \textit{W}age
\\  \XLev & & e\textit{X}penditures (as distinct from consumption; e.g., for durables)
\\  \YLev & & Noncapital income (usually, the sum of transfer and labor income)
\\  \ZLev & & Lei\textit{Z}ure in consumption/leisure tradeoff
\\ \hline
\end{tabular}
\end{center}
\caption{Preferred Usages of Roman Letters}
\label{table:RomanLetters}
\end{table}

\subsection{Exceptions to the Rules}

The letter $\TLev$ is an exception to the rule that lower- and upper-case versions of variables are individual and aggregate quantities.  We reserve the capital letter to designate the end of the horizon (death, or the end of the economy, occurs at the end of period $\TLev$).  The lower case version $t$ is so ubiquitiously used as the current time period that we do not want to resist the overwhelming force of tradition to prohibit its use in that capacity.

Finally, the following are exempted from the prohibition on single-letter variable names because they are used so frequently that the prohibition would be more trouble than it is worth: $a$, $b$, $c$, $m$.

\pagebreak

\subsection{Strings}

There are more objects that are likely to be used extensively in ARK projects than there are Roman letters.  We present preferred usages for some of those commonly-needed variables here.

\begin{table}[h]
\begin{center}
\begin{tabular}{|rcl|}
\hline
Name & - & Description
 \\ \hline
     \texttt{CND}    & - & Consumption of Nondurable Good
 \\  \texttt{Cst}    & - & Cost of something
 \\  \texttt{Dgd}    & - & Stock of durable good
 \\  \texttt{Dvd}    & - & Dividends
 \\  \texttt{Hse}    & - & Quantity of housing (\textit{not} value, which is quantity $\times$ price)
 \\  \texttt{Nlq}    & - & Quantity that is \textbf{N}ot \textbf{l}i\textbf{q}uid (e.g., $\mathtt{aNlq}$ is illiquid financial)
 \\  \texttt{Lbr}    & - & Quantity of labor
 \\  \texttt{Pop}    & - & Size of population
 \\  \texttt{Tax} & - & Tax -- should be modified by \texttt{Rte} or \texttt{Amt} articulated below
 \\  \texttt{Perm}   & - & Permanent income
 \\  \texttt{Tran}   & - & Transitory income
\\ \hline
\end{tabular}
\caption{String Variables}
\label{table:Strings}
\end{center}
\end{table}

\section{Factors and Rates}
  When measuring change over time, lower-case variables reflect rates
  while the corresponding upper-case variable connects adjacent discrete periods.\footnote{This
  convention rarely conflicts with the usage we endorse elsewhere of
  indicating individual-level variables by the lower and aggregate
  variables by the upper case.}$^{,}$\footnote{If there is a need for the continuous-time
representation, we endorse use of the discrete-time rate defined below.  Any
author who needs a continuous-time rate, a discrete-time rate, and a discrete-time factor
is invited to invent their own notation.}  So, for example, if the time interval is a year and the annual interest rate is $\rfree=0.03$ or three percent, then
the annual interest factor is $\Rfree=1.03$.\footnote{In the rare cases where it is necessary to distinguish between a continuous-time rate and a discrete-time rate -- for example, when there is an analytical result available in continuous time -- the variable in question can be modified by \texttt{Cnt} or \texttt{Dsc}.}

\begin{table}[h]
	\centering
	\begin{tabular}{|ccc|}
		\hline
Code    & Output & Description
\\ \hline
   \verb|\Rfree| & $\Rfree$     & Riskfree interest factor
\\ \verb|\rfree| & $\rfree$     & Riskfree interest rate
\\ \verb|\Risky| & $\Risky$     & The return factor on a risky asset
\\ \verb|\risky| & $\risky$     & The return rate on a risky asset
\\ \verb|\Rport| & $\Rport$     & The return factor on the entire portfolio
\\ \verb|\rport| & $\rport$     & The return rate on the entire portfolio
\\ \verb|\RSave| & $\RSave$     & Return factor earned on positive end-of-period assets
\\ \verb|\rsave| & $\rsave$     & Return rate earned on positive end-of-period assets
\\ \verb|\RBoro| & $\RBoro$     & Return factor paid on debts
\\ \verb|\rboro| & $\rboro$     & Return rate paid on debts
\\	\hline
	\end{tabular}
	\caption{Factors and Rates}
	\label{table:Factors}
\end{table}

We depart from the upper-lower case scheme when the natural letter to use has an even more urgent use elsewhere in our scheme.
A particularly common example occurs in the case of models like \cite{blanchardFinite} in which
individual agents are subject to a Poisson probability of death.  Because death was common in the
middle ages, we use the archaic Gothic font for the death rate; and the probability of survival is the cancellation of the probability of death:
\begin{table}[h]
	\centering
	\begin{tabular}{|>{\ttfamily}cccl|}
		\hline
		 Code & \LaTeX & Description &  \\
		\hline
   \verb|\DieFac|     & $\DieFac$     & Probabilty of death &
\\ \verb|\LivFac|     & $\LivFac$     & Probability to not die $=(1-\DieFac)$ &
\\	\hline
	\end{tabular}
	\caption{Special Cases: Factors and Rates}
	\label{table:SpecialFactors}
\end{table}

\section{Parameters}
  Some parameters are worth defining because they are likely to be
  used in a high proportion of models; others are subject to enough
  constraints when used (such as the need for similar-looking upper-
  and lower-case Greek representations), as to be worth standardizing.

Programmers should
use the corresponding variable name without the backslash as the name of the corresponding object
in their code.  For example, the Coefficient of Relative Risk Aversion is $\verb|\CRRA|$ in a \LaTeX
document and \texttt{CRRA} in a software module.

\begin{table}[h]
	\centering
	\begin{tabular}{|>{\ttfamily}rcll|}
		\hline
		 Name    & \LaTeX         & Description & Illustration
  \\ \hline
     \verb|\CARA|        & $\CARA$       & Coefficient of Absolute Risk Aversion &$\uFunc(\bullet)=-\CARA^{-1} e^{-\CARA \bullet}$
  \\ \verb|\CRRA|        & $\CRRA$       & Coefficient of Relative Risk Aversion & $\uFunc(\bullet)=(1-\CRRA)^{-1}\bullet^{1-\CRRA}$
  \\ \verb|\DiscFac|     & $\DiscFac$    & Time Discount Factor & $\uFunc^{\prime}(\cLev_{t}) =  \Rfree \DiscFac \uFunc^{\prime}(\cLev_{t+1})$
  \\ \verb|\discRte|     & $\discRte$    & Time Discount rate & $\discRte=\DiscFac^{-1}-1$
  \\ \verb|\DeprFac|     & $\DeprFac$    & Depreciation Factor (Hebrew \texttt{daleth}) & $\Kap_{t+1} = \DeprFac \Kap_{t}+\ILev_{t}$
  \\ \verb|\deprRte|     & $\deprRte$    & Depreciation Rate & $\DeprFac = 1-\deprRte$
  \\ \verb|\TranShkAgg|  & $\TranShkAgg$ & Transitory shock (aggregate) & $\Ex_{t}[\TranShkAgg_{t+n}]=1$ if $\TranShkAgg$ iid
  \\ \verb|\tranShkInd|  & $\tranShkInd$ & Transitory shock (individual) &  $\Ex_{t}[\tranShkInd_{t+n}]=1$ if $\tranShkInd$ iid
  \\ \verb|\PermShkAgg|  & $\PermShkAgg$ & Permanent shock (aggregate) & $\Ex_{t}[\PermShkAgg_{t+n}]=1$ if $\PermShkAgg$ iid
  \\ \verb|\permShkInd|  & $\permShkInd$ & Permanent shock (individual) & $\Ex_{t}[\permShkInd_{t+n}]=1$ if $\permShkInd$ iid
  \\ \verb|\PopGro|  & $\PopGro$ & Population Growth Factor & $\mathtt{Pop}_{t+1} = \PopGro \mathtt{Pop}_{t}$
  \\ \verb|\popGro|  & $\popGro$ & Population Growth rate & $\PopGro = 1 + \popGro$
  \\ \verb|\PtyGro|  & $\PtyGro$ & Productivity Growth Factor & $\GLev = \PtyGro \PopGro$
  \\ \verb|\ptyGro|  & $\ptyGro$ & Productivity Growth rate & $\PtyGro = (1+\ptyGro)$
  \\ \verb|\leiShare|  & $\leiShare$ & Leisure share, Cobb-Douglas utility & $\uFunc(c,z)=(1-\CRRA)^{-1}(c^{1-\leiShare}z^{\leiShare})^{1-\CRRA}$
  \\ \verb|\MPC|  & $\MPC$ & Marginal Propensity to Consume & $\cFunc^{\prime}(\mRat)=\partial c/\partial m$
  \\ \verb|\Pat|  & $\Pat$ & Absolute Patience Factor (\texttt{Thorn}) & $\Pat = (\Rfree \DiscFac)^{1/\CRRA} $
  \\ \verb|\PatPGro| & $\PatPGro$ & Growth Patience Factor (\texttt{Thorn}) & $\Pat = (\Rfree \DiscFac)^{1/\CRRA}/\PtyGro $
  \\ \verb|\PatR| & $\PatR$ & Return Patience Factor (\texttt{Thorn}) & $\Pat = (\Rfree \DiscFac)^{1/\CRRA}/\Rfree $
  \\ \verb|\pat|  & $\pat$ & Absolute Patience rate (\texttt{thorn}) & $\pat = (\Rfree \DiscFac)^{1/\CRRA}-1 \approx \CRRA^{-1}(\rfree-\discRte) $
  \\ \verb|\patpGro| & $\patpGro$ & Growth Patience rate (\texttt{thorn}) & $\patpGro = \pat -\ptyGro $
  \\ \verb|\patr| & $\patr$ & Return Patience rate (\texttt{thorn}) & $\patr =\pat -\rfree $
  \\ \verb|\riskyshare|  & $\riskyshare$ & Portfolio share in risky assets & $\Rport_{t+1}=(1-\riskyshare)\Rfree+\riskyshare\Risky_{t+1}$
  \\	\hline
	\end{tabular}
	\caption{Parameters}
	\label{table:Parameters}
\end{table}

Mnemonics:
\begin{itemize}
\item Hebrew \texttt{daleth} is the fourth letter of the Hebrew alphabet (as d and $\delta$ are of the Roman and Greek) and is an etymological and linguistic cousin of those letters
\item $\discRte$ is the lower case Greek letter \texttt{omega}, because people say ``OMG, I've got to think about the future.''
\item You are invited to scrutinize $\Xi$ yourself to imagine reasons it could represent something to do with population growth.
\item The glorious letter $\Pat$ (pronounced `\href{http://en.wikipedia.org/wiki/Thorn_(letter)}{thorn}') enriched Old English, Gothic, and some other defunct alphabets; sadly, it remains in use today only in Iceland.  It is useful because having to type the many symbols in the object $(\Rfree \DiscFac)^{1/\CRRA}$ over and over again is a \textit{thorn} in the side of economists working with dynamic models!  (It is the `absolute patience factor' because if it is less than one the consumer wants to bring resources from the future to the present and is therefore absolutely impatient; for a fuller discussion of this terminology, see \cite{carrollTractable}.)
\end{itemize}

\section{Operators}
A few operators are so universally used that it will be useful to define them.

\begin{table}[h]
	\centering
	\begin{tabular}{|>{\ttfamily}rcll|}
		\hline
		 Name    & \LaTeX         & Description & Illustration
  \\ \hline
     \verb|\Ex|        & $\Ex$       & The expectation as of date $t$ & $\Ex_{t}[\uFunc^{\prime}(\cRat_{t+1})]$
\\   \verb|\PDV|        & $\PDV$       & Present Discounted Value & $\PDV_{t}^{T}(y)$ is human wealth
  \\	\hline
	\end{tabular}
	\caption{Operators}
	\label{table:Operators}
\end{table}

\section{Modifiers}
\begin{table}[h]
	\centering
	\begin{tabular}{|>{\ttfamily}ccc|}
		\hline
   \textit{[object]}\texttt{Agg} & - & Value of something at the aggregate level (as opposed to \texttt{Ind})
\\ \textit{[object]}\texttt{Ind} & - & Value of something at the level of an individual (as opposed to \texttt{Agg})
\\ \textit{[object]}\texttt{Lvl} & - & Level
\\ \textit{[object]}\texttt{Rto} & - & Ratio
\\ \textit{[object]}\texttt{Bot} & - & Lower value in some range
\\ \textit{[object]}\texttt{Top} & - & Upper value in some range
\\ \textit{[object]}\texttt{Min} & - & Minimum possible value
\\ \textit{[object]}\texttt{Max} & - & Maximum possible value
\\ \textit{[object]}\texttt{Cnt} & - & Continuous-time value
\\ \textit{[object]}\texttt{Dsc} & - & Discrete-time value
\\ \textit{[object]}\texttt{Shk} & - & Shock
\\ \textit{[object]}\texttt{Trg} & - & The `target' value of a variable
\\ \textit{[object]}\texttt{Rte} & - & A `rate' variable like the discount rate $\discRte$
\\ \textit{[object]}\texttt{Fac} & - & A factor variable like the discount factor $\DiscFac$
\\ \textit{[object]}\texttt{Amt} & - & An amount, like \texttt{TaxAmt} which might be lump-sum
\\ 	\hline
	\end{tabular}
	\caption{General Purpose Modifiers}
	\label{table:General}
\end{table}

Shocks will generally be represented by finite vectors of outcomes and their probabilities.  For example, permanent income is called \texttt{Perm} and shocks are designated \texttt{PermShk}
\begin{table}[ht]
	\centering
	\begin{tabular}{|>{\ttfamily}ccc|}
		\hline
   \textit{[object]}\texttt{Prbs} & - & Probabilities of outcomes (e.g. \texttt{PermShkPrbs} for permanent shocks)
\\ \textit{[object]}\texttt{Vals} & - & Values (e.g., for mean one shock \texttt{PermShkVals} . \texttt{PermShkPrbs} = 1)
\\ \textit{[object]}\texttt{Dstn} & - & Representation of a probability distribution (includes both Prbs and Vals)
\\ 	\hline
	\end{tabular}
	\caption{Probabilities}
	\label{table:Probabilities}
\end{table}

Timing can be confusing because there can be multiple ordered steps
within a `period.'  We will use \texttt{Prev}, \texttt{Curr}, \texttt{Next} to refer
to steps relative to the local moment within a period, and $t$ variables to refer to succeeding periods:
\begin{table}[h]
	\centering
	\begin{tabular}{|>{\ttfamily}lcl|}
		\hline
   \textit{[object]}tm2 & - & object in period $t$ minus 2
\\ \textit{[object]}tm1 & - & object in period $t$ minus 1
\\ \textit{[object]}Now & - & object in period $t$
\\ \textit{[object]}t\phantom{p1}   & - & object in period $t$ (alternative definition)
\\ \textit{[object]}tp1 & - & object in $t$ plus 1
\\ \textit{[object]}tpn & - & object in $t$ plus $n$
\\ \textit{[object]}Prev & - & object in previous subperiod
\\ \textit{[object]}Curr & - & object in current subperiod
\\ \textit{[object]}Next & - & object in next subperiod
\\	\hline
	\end{tabular}
	\caption{Timing}
	\label{table:Timing}
\end{table}

\input econtexBibMake

\end{document}


\documentclass[a4paper,10pt, notitlepage]{report}
\usepackage{geometry}
\geometry{verbose,tmargin=30mm,bmargin=25mm,lmargin=25mm,rmargin=25mm}
\usepackage[utf8]{inputenc}
\usepackage[sectionbib]{natbib}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{cancel}
\usepackage{mathtools}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\hypersetup{colorlinks=true,citecolor=blue}

\newtheorem{thm}{Theorem}
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{proposition}[thm]{Proposition}
\newtheorem{remark}[thm]{Remark}
\newtheorem{defn}[thm]{Definition}

%%%%%%%%%%%%%%%%%%%% Notation stuff
\newcommand{\pr}{\operatorname{Pr}} %% probability
\newcommand{\vr}{\operatorname{Var}} %% variance
\newcommand{\rs}{X_1, X_2, \ldots, X_n} %%  random sample
\newcommand{\irs}{X_1, X_2, \ldots} %% infinite random sample
\newcommand{\rsd}{x_1, x_2, \ldots, x_n} %%  random sample, realised
\newcommand{\bX}{\boldsymbol{X}} %%  random sample, contracted form (bold)
\newcommand{\bx}{\boldsymbol{x}} %%  random sample, realised, contracted form (bold)
\newcommand{\bT}{\boldsymbol{T}} %%  Statistic, vector form (bold)
\newcommand{\bt}{\boldsymbol{t}} %%  Statistic, realised, vector form (bold)
\newcommand{\emv}{\hat{\theta}}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}

% Title Page
\title{Exam 1 (A1)}
\author{Class: Bayesian Statistics \\ Instructor: Luiz Max Carvalho}
\date{26/04/2021}

\begin{document}
\maketitle

\textbf{Turn in date: until 28/04/2021 at 23:59h Brasilia Time.}

\begin{center}
\fbox{\fbox{\parbox{1.0\textwidth}{\textsf{
    \begin{itemize}
    \item Please read through the whole exam before starting to answer;
    \item State and prove all non-trivial mathematical results necessary to substantiate your arguments;
    \item Do not forget to add appropriate scholarly references~\textit{at the end} of the document;
    \item Mathematical expressions also receive punctuation;
    \item You can write your answer to a question as a point-by-point response or in ``essay'' form, your call;
    \item Please hand in a single, \textbf{typeset} ( \LaTeX) PDF file as your final main document.
 Code appendices are welcome,~\textit{in addition} to the main PDF document.
    \item You may consult any sources, provided you cite \textbf{ALL} of your sources (books, papers, blog posts, videos);
    \item You may use symbolic algebra programs such as Sympy or Wolfram Alpha to help you get through the hairier calculations, provided you cite the tools you have used.
    \item The exam is worth $\min\left\{\text{your\:score}, 100\right\}$ marks.
    \end{itemize}}
}}}
\end{center}
% \newpage
% \section*{Hints}
% \begin{itemize}
%  \item a
%  \item b
% \end{itemize}
%
\newpage

\section*{Background}

This exam covers decision theory, prior elicitation and  point estimation.
You will need a little measure theory here and there and also be sharp with your knowledge of expectations and conditional expectations.

\section*{1. Warm up: stretching our Bayesian muscles with a classic.}

\cite{Bayes1763}\footnote{The paper was published posthumously and read to the Royal Society by Bayes's close friend Richard Price (1723-1791).}: a billiard ball $W$ is rolled on a line of length $L = 1$, with uniform probability of stopping anywhere on $L$.
It stops at $0 < p < 1$.
A second ball, $O$, is then rolled $n$ times under the same assumptions.
Let $X$ denote the number of times (out of $n$) that $O$ stopped to the left of $W$.
Given $X=x$, \textbf{what inference(s) can we make on $p$}?
You may assume $n\geq2$.

The idea here is to provide a rigorous, principled Bayesian analysis of this $250$ years old problem.
Here are a few road signs to help you in your analysis:
\begin{enumerate}[label=\alph*)]
 \item (10 marks) For the problem at hand, \textbf{carefully} define the parameter space, data-generating mechanism, likelihood function and all of crucial elements of a Bayesian analysis. What is the dominating measure?
 \item (10 marks) Exhibit your posterior measure and sketch its density.

 \textit{Hint:} it might be convenient to prove the following proposition:
 \begin{proposition}
 \label{prop:joint_bayes}
 The joint distribution of $p$ and $X$ is given by
 \begin{equation*}
  \pr(a < p < b, X = x) = \int_{a}^{b} \binom{n}{x} t^x(1-t)^{n-x}\,dt.
 \end{equation*}
 \end{proposition}
 \item (10 marks) Provide a Bayes estimator under (i) quadratic and (ii) 0-1 loss\footnote{Recall the discussion in class about how to properly define 0-1 loss as for continuous parameter spaces.};
 \item (10 marks) Contrast the estimators obtained in the previous item  with the maximum likelihood estimator, in terms of (i) posterior expected loss and (ii) integrated risk.
 Is any of the estimators preferable according to both risks?
 If not, which estimator should be preferred under each goal risk?
 \item (10 marks) Suppose one observes $X = x = 6$ for $n=9$ rolls.
 Produce an updated prediction of where the next $m$ balls are going to stop along $L$.
 Please provide (i) a point prediction in the form of an expected value and (ii) a full probability distribution.
\end{enumerate}

\section*{2. Proper behaviour.}

In this question we will explore propriety and its implications for inference.
Consider a parameter space $\boldsymbol{\Theta}$ and a sampling model with density $f(x \mid \theta)$.
A density $h : \boldsymbol{\Theta} \to (0, \infty)$ is said to be proper if
\begin{equation*}
 \int_{\boldsymbol{\Theta}} h(t)\,d\mu(t)  < \infty,
\end{equation*}
where $\mu$ is the dominating measure.
Assuming $\mu$ to be the Lebesgue measure and that the prior $\pi(\theta)$ is proper, show that
\begin{itemize}
 \item[a)] (10 marks) The posterior density,
 \begin{equation*}
  \xi(\theta \mid x) = \frac{f(x\mid \theta)\pi(\theta)}{m(x)},
 \end{equation*}
is proper almost surely.
\item[b)] (10 marks) The Bayes estimator under quadratic loss, $\delta_{\text{S}}(x) = E_\xi[\theta]$ is biased almost surely.
\textit{Hint:} consider what happens to the integrated risk under unbiasedness.
\end{itemize}
Now,
\begin{itemize}
 \item[c)] (10 marks) Take
$$f(x \mid \theta) = \frac{2x}{\theta}, x \in [0, \sqrt{\theta}],$$
and
$$ \pi(\theta) = \frac{2}{\pi (1 +\theta^2)}, \theta > 0.$$
The posterior density is then
\begin{equation*}
 p(\theta \mid x) = \frac{1}{m(x)} \frac{4x}{\pi}\frac{1}{\theta(1 +\theta^2)},
\end{equation*}
 and thus
\begin{equation*}
 m(x) = \int_{0}^\infty \frac{4x}{\pi} \frac{1}{t(1 +t^2)}\,dt = \frac{4x}{\pi} \int_{0}^\infty \frac{1}{t(1 +t^2)}\,dt = \infty,
\end{equation*}
i.e., the posterior is apparently improper.
Explain how this ``counter-example'' is wrong.
\end{itemize}

\section*{3. Rayleigh dispersion\footnote{This question's title is pun: \url{https://en.wikipedia.org/wiki/Rayleigh_scattering}.}.}

Let $X_1, \ldots, X_n$ be a random sample from a distribution whose probability density function is
\begin{equation*}
 f(x \mid \sigma) = \frac{x}{\sigma^2} \exp\left(-\frac{x^2}{2\sigma^2}\right),\, \sigma>0,\, 0 < x < \infty.
\end{equation*}
This is the Rayleigh\footnote{John William Strutt (1842-1919), the Third Baron Rayleigh, was a British physicist, known for his work on Statistical Mechanics.} distribution, used in reliability modelling, where the $X$ are failure times (time-until-failure).
\begin{itemize}
 \item[a)] (5 marks) For $t$ fixed and known, find $\eta = \pr(X > t)$ as function of $\sigma^2$;
 \item[b)] (5 marks) Find the likelihood function for $\eta$ for a sample $\boldsymbol{x} = \{x_1, \ldots, x_n\}$;
 \item[c)] (10 marks) Is the Rayleigh distribution a member of the exponential family? Justify your answer;
 \item[d)] (10 marks) Find the Jeffreys's prior for $\eta$, $\pi_J(\eta)$;
 \item[e)] (10 marks) Using $\pi_J(\eta)$, derive the predictive distribution $p(\tilde{x} \mid \boldsymbol{x})$.
\end{itemize}

\bibliographystyle{apalike}
\bibliography{a1}
\end{document}


\documentclass[12pt]{article}
%\documentclass[12pt,landscape]{article}

\include{preamble}

\newcommand{\instr}{\scriptsize Your answer will consist of a string (e.g. \texttt{aebgd}) where the order of the letters does not matter nor does upper / lowercase. \normalsize}
\newcommand{\recordletters}{\small Record the letter(s) of all the following that are \textbf{true}. \normalsize}

\title{Math 341 Spring 2020 \\ Final Examination}
\author{Professor Adam Kapelner}

\date{Thursday, May 21, 2020}

\begin{document}
\maketitle

%\noindent Full Name \line(1,0){410}

\thispagestyle{empty}

\section*{Code of Academic Integrity}

\footnotesize
Since the college is an academic community, its fundamental purpose is the pursuit of knowledge. Essential to the success of this educational mission is a commitment to the principles of academic integrity. Every member of the college community is responsible for upholding the highest standards of honesty at all times. Students, as members of the community, are also responsible for adhering to the principles and spirit of the following Code of Academic Integrity.

Activities that have the effect or intention of interfering with education, pursuit of knowledge, or fair evaluation of a student's performance are prohibited. Examples of such activities include but are not limited to the following definitions:

\paragraph{Cheating} Using or attempting to use unauthorized assistance, material, or study aids in examinations or other academic work or preventing, or attempting to prevent, another from using authorized assistance, material, or study aids. Example: using an unauthorized cheat sheet in a quiz or exam, altering a graded exam and resubmitting it for a better grade, etc.
\\

\noindent I acknowledge and agree to uphold this Code of Academic Integrity. \\

%\begin{center}
%\line(1,0){250} ~~~ \line(1,0){100}\\
%~~~~~~~~~~~~~~~~~~~~~signature~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ date
%\end{center}

\normalsize

\section*{Instructions}

This exam is 120 minutes with a bathroom break (with time limit varying for each question). The exam has 145 points and your final score will be scaled out of 100\%. The exam is closed book but you are allowed \textbf{three} pages (front and back) of a \qu{cheat sheet}, one table of reference and scrap paper and a graphing calculator. Please read the questions carefully. No food is allowed, only drinks. %If the question reads \qu{compute,} this means the solution will be a number otherwise you can leave the answer in \textit{any} widely accepted mathematical notation which could be resolved to an exact or approximate number with the use of a computer. I advise you to skip problems marked \qu{[Extra Credit]} until you have finished the other questions on the exam, then loop back and plug in all the holes. I also advise you to use pencil. The exam is 100 points total plus extra credit. Partial credit will be granted for incomplete answers on most of the questions. \fbox{Box} in your final answers. Good luck!

\pagebreak

\problem [4min] We return the topic of inference for a baseball batting averages, the $\theta$ in a binomial model for a fixed number of $n$ at bats where the realization $x$ is the \# of hits.

\benum\subquestionwithpoints{8} \recordletters

\begin{enumerate}[(a)]
\item $\prob{\theta} = \binomial{n}{\infty}$ is conjugate.
\item $\prob{\theta} = \binomial{n}{\infty}$ is proper.
\item $\prob{\theta} = \betanot{0}{0}$ is conjugate.
\item $\prob{\theta} = \betanot{0}{0}$ is proper.
\item $\prob{\theta} = \betanot{1}{1}$ is uninformative.
\item $\prob{\theta} = \betanot{1}{1}$ is proper.
\item $\prob{\theta} = \betanot{42.3}{127.7}$ is uninformative.
\item $\prob{\theta} = \betanot{42.3}{127.7}$ is proper.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [22min] Imagine the batter bats both leftie and rightie (both sides of the oncoming ball). The propensity to get a hit when batting leftie is $\theta_L$ and the propensity to get a hit on when batting rightie is $\theta_R$. He bats leftie $\rho$ proportion of the games. Let $I_i$ be the indicator variable indicating if he bats leftie for the $i$th game (it is equal to 1 when he bats leftie and equal to 0 if he bats rightie). There are $n$ independent at bats per game and $G$ independent total games per season and both $n$ and $G$ are known. The data $x_1, \ldots, x_G$ are number of hits per game. All other quantities are unknown.

\benum\subquestionwithpoints{17} \recordletters

\begin{enumerate}[(a)]
\item $\cprob{X}{\theta_L, \theta_R, \rho} = \binomial{G}{\theta_L + \theta_R}$
\item $\cprob{X}{\theta_L, \theta_R, \rho} = \binomial{G}{\rho\theta_L + (1-\rho)\theta_R}$
\item $\cprob{X}{\theta_L, \theta_R, \rho} = \prod_{i=1}^G \parens{\rho\theta_L (1 - \theta_L) + (1-\rho)\theta_R (1 - \theta_R)}$
\item $\cprob{X}{\theta_L, \theta_R, \rho} = \prod_{i=1}^G \parens{\rho\theta_L^{x_i} (1 - \theta_L)^{n - x_i} + (1-\rho)\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}$
\item $\cprob{X}{\theta_L, \theta_R, \rho} = \prod_{i=1}^G \parens{\rho\binom{n}{x_i}\theta_L^{x_i} (1 - \theta_L)^{n - x_i} + (1-\rho) \binom{n}{x_i} \theta_R^{x_i} (1 - \theta_R)^{n - x_i}}$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prod_{i=1}^G \parens{\rho\theta_L^{x_i} (1 - \theta_L)^{n - x_i} + (1-\rho)\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} =$ \\ $\prod_{i=1}^G \parens{\tothepow{\rho \binom{n}{x_i} \theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{I_i} + \tothepow{(1-\rho) \binom{n}{x_i} \theta_R^{x_i} (1 - \theta_R)^{n - x_i}}{1 - I_i}}$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prod_{i=1}^G \tothepow{\rho\binom{n}{x_i}\theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{I_i} \tothepow{(1-\rho)\binom{n}{x_i}\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}{1 - I_i}$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prod_{i=1}^G \tothepow{\binom{n}{x_i}\theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{I_i} \tothepow{\binom{n}{x_i}\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}{1 - I_i}$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prod_{i=1}^G \binom{n}{x_i} \prod_{i=1}^G \tothepow{\theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{I_i} \tothepow{\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}{1 - I_i}$
\item $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X} = \cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}$
\item $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X} = \cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}$
\item $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X} \propto \cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}$
\item $\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prob{\theta_L, \theta_R}\prob{\rho, I_1, \ldots, I_G}$ if $\theta_L, \theta_R$ are independent of $\rho, I_1, \ldots, I_G$.
\item $\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prob{\theta_L}\prob{\theta_R}\prob{\rho}\cprob{I_1, \ldots, I_G}{\rho}$ if $\theta_L, \theta_R$ are independent of $\rho, I_1, \ldots, I_G$ and $\theta_L, \theta_R$ are independent of each other.
\item $\cprob{I_1, \ldots, I_G}{\rho} = \binomial{G}{\rho}$
\item $\cprob{I_1, \ldots, I_G}{\rho} = \rho^{\sum_{i=1}^G I_i} (1 - \rho)^{\sum_{i=1}^G (1 - I_i)}$
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [15min] \ingray{ Imagine the batter bats both leftie and rightie (both sides of the oncoming ball). The propensity to get a hit when batting leftie is $\theta_L$ and the propensity to get a hit on when batting rightie is $\theta_R$. He bats leftie $\rho$ proportion of the games. Let $I_i$ be the indicator variable indicating if he bats leftie for the $i$th game (it is equal to 1 when he bats leftie and equal to 0 if he bats rightie). There are $n$ independent at bats per game and $G$ independent total games per season and both $n$ and $G$ are known. The data $x_1, \ldots, x_G$ are number of hits per game. All other quantities are unknown.} All sum signs are indexed from $1, \ldots, G$. The full likelihood is

\beqn
\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prod_{i=1}^G \tothepow{\theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{I_i} \tothepow{\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}{1 - I_i} \prod_{i=1}^G \binom{n}{x_i}
\eeqn

\noindent and the prior is

\beqn
\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \prob{\theta_L}\prob{\theta_R} \prob{\rho} \rho^{\sum I_i} (1 - \rho)^{\sum (1 - I_i)}
\eeqn

\noindent Assume the following about the components in the overall prior:

\beqn
\prob{\theta_L} \propto 1,~\prob{\theta_R} \propto 1,~\prob{\rho} \propto 1.
\eeqn

\benum\subquestionwithpoints{14} \recordletters

\begin{enumerate}[(a)]
\item The prior is uninformative.
\item The prior is improper.
\item $\prob{\theta_L} = \betanot{1}{1}$
\item $\prob{\theta_L} = \gammanot{1}{0}$
\item $\prob{I_i} = \stduniform$ for all $i$
\item $\prob{X} = \stduniform$.
\item $\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} =  \rho^{\sum I_i} (1 - \rho)^{\sum (1 - I_i)}$
\item $\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} \propto \rho^{\sum I_i} (1 - \rho)^{\sum (1 - I_i)}$
\item The conjugate model for $\theta_L, \theta_R, \rho, I_1, \ldots, I_G$ under the likelihood above is a standard distribution we have studied before.
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} \propto 1$
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \tothepow{\theta_L^{\sum x_i} (1 - \theta_L)^{n - \sum x_i}}{I_i} \tothepow{\theta_R^{\sum x_i} (1 - \theta_R)^{n - \sum x_i}}{1 - I_i} \prod_{i=1}^G \binom{n}{x_i} $
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \theta_L^{\sum I_i x_i} (1 - \theta_L)^{\sum  (1 - I_i) x_i}\theta_R^{\sum (1 - I_i) x_i} (1 - \theta_R)^{n - \sum (1 - I_i) x_i} \prod_{i=1}^G \binom{n}{x_i} $
\item $\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \theta_L^{\sum I_i x_i} (1 - \theta_L)^{\sum I_i(n - x_i)}\theta_R^{\sum (1 - I_i) x_i} (1 - \theta_R)^{\sum (1 - I_i) (n - x_i)} \prod_{i=1}^G \binom{n}{x_i} $
\item There are constants that can be removed when finding the kernel of (m).
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [15min] \ingray{ Imagine the batter bats both leftie and rightie (both sides of the oncoming ball). The propensity to get a hit when batting leftie is $\theta_L$ and the propensity to get a hit on when batting rightie is $\theta_R$. He bats leftie $\rho$ proportion of the games. Let $I_i$ be the indicator variable indicating if he bats leftie for the $i$th game (it is equal to 1 when he bats leftie and equal to 0 if he bats rightie). There are $n$ independent at bats per game and $G$ independent total games per season and both $n$ and $G$ are known. The data $x_1, \ldots, x_G$ are number of hits per game. All other quantities are unknown.  All sum signs are indexed from $1, \ldots, G$. The full likelihood is }

\beqn
\cprob{X}{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \theta_L^{\sum I_i x_i} (1 - \theta_L)^{\sum I_i(n - x_i)}\theta_R^{\sum (1 - I_i) x_i} (1 - \theta_R)^{\sum (1 - I_i) (n -x_i)}  \prod_{i=1}^G \binom{n}{x_i}
\eeqn

\noindent and assume the prior is

\beqn
\prob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G} = \rho^{\sum I_i} (1 - \rho)^{\sum (1 - I_i)}
\eeqn

\benum\subquestionwithpoints{16} \recordletters

\begin{enumerate}[(a)]
\item $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X} \propto \theta_L^{\sum I_i x_i} (1 - \theta_L)^{\sum I_i(n - x_i)} \theta_R^{\sum (1 - I_i) x_i} (1 - \theta_R)^{\sum (1 - I_i) (n - x_i)} \times$ \\
\color{white}.\color{black}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$\rho^{\sum I_i} (1 - \rho)^{n - \sum I_i}$
\item $\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G} \propto 1$
\item $\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G} \propto \theta_L^{\sum I_i x_i} (1 - \theta_L)^{\sum I_i(n - x_i)}$
\item $\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G} \propto \binomial{\theta_L}{\sum I_i}$
\item $\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G} \propto \betanot{1 + \sum I_i x_i}{1 + \sum I_i(n - x_i)}$

\item $\cprob{\theta_R}{X, \theta_L, \rho, I_1, \ldots, I_G} \propto 1$
\item $\cprob{\theta_R}{X, \theta_L, \rho, I_1, \ldots, I_G} \propto \theta_R^{\sum (1 - I_i) x_i} (1 - \theta_R)^{\sum (1 - I_i) (n - x_i)} $
\item $\cprob{\theta_R}{X, \theta_L, \rho, I_1, \ldots, I_G} \propto \binomial{\theta_R}{n - \sum I_i}$
\item $\cprob{\theta_R}{X, \theta_L, \rho, I_1, \ldots, I_G} \propto \betanot{1 + \sum (1 - I_i) x_i}{1 + \sum (1 - I_i) (n - x_i)}$

\item $\cprob{\rho}{X, \theta_L, \theta_R, I_1, \ldots, I_G} \propto 1$
\item $\cprob{\rho}{X, \theta_L, \theta_R, I_1, \ldots, I_G} \propto \rho^{\sum I_i} (1 - \rho)^{\sum (1 - I_i)} $
\item $\cprob{\rho}{X, \theta_L, \theta_R, I_1, \ldots, I_G} \propto \binomial{\rho}{\sum (1 - I_i)}$
\item $\cprob{\rho}{X, \theta_L, \theta_R, I_1, \ldots, I_G} \propto \betanot{1 + \sum I_i}{1 + \sum (1 - I_i) }$

\item $\cprob{I_1}{X, \theta_L, \theta_R, I_2, \ldots, I_G, \rho} =$ Bernoulli($\cdot$) with a parameter that is a function of $X, \theta_L, \theta_R, I_2, \ldots, I_G, \rho$.
\item $\cprob{I_1}{X, \theta_L, \theta_R, I_2, \ldots, I_G, \rho} =$ Bernoulli($\cdot$) with a parameter that is a function of $X, \theta_L, \theta_R, \rho$.
\item $\cprob{I_1}{X, \theta_L, \theta_R, I_2, \ldots, I_G, \rho} =$ Bernoulli($\cdot$) with a parameter that is a function of only $X$ and $\rho$.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [8min] \ingray{ Imagine the batter bats both leftie and rightie (both sides of the oncoming ball). The propensity to get a hit when batting leftie is $\theta_L$ and the propensity to get a hit on when batting rightie is $\theta_R$. He bats leftie $\rho$ proportion of the games. Let $I_i$ be the indicator variable indicating if he bats leftie for the $i$th game (it is equal to 1 when he bats leftie and equal to 0 if he bats rightie). There are $n$ independent at bats per game and $G$ independent total games per season and both $n$ and $G$ are known. The data $x_1, \ldots, x_G$ are number of hits per game. All other quantities are unknown.  All sum signs are indexed from $1, \ldots, G$.} Consider a Gibbs sampler using the following conditional distributions:

\beqn
\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G} &=& \betanot{1 + \sum I_i x_i}{1 + \sum I_i(n - x_i)} \\
\cprob{\theta_R}{X, \theta_L, \rho, I_1, \ldots, I_G} &=& \betanot{1 + \sum (1 - I_i) x_i}{1 + \sum (1 - I_i) (n - x_i)} \\
\cprob{\rho}{X, \theta_L, \theta_R, I_1, \ldots, I_G} &=& \betanot{1 + \sum I_i}{1 + \sum (1 - I_i) } \\
\forall i~~\cprob{I_i}{X, \theta_L, \theta_R, I_{-i}, \rho} &=& \bernoulli{\frac{\rho\theta_L^{x_i} (1 - \theta_L)^{n - x_i}}{\rho\theta_L^{x_i} (1 - \theta_L)^{n - x_i} + (1 - \rho)\theta_R^{x_i} (1 - \theta_R)^{n - x_i}}}
\eeqn

\benum\subquestionwithpoints{13} \recordletters

\begin{enumerate}[(a)]
\item The first conditional distribution can be sampled using the \texttt{rbeta} function.
\item This Gibbs sampler will converge after a sufficient burn-in period.
\item This Gibbs sampler will converge after thinning.
\item This Gibbs sampler does not include all the conditional distributions necessary to provide samples from the posterior.
\item This Gibbs sampler will not converge if we pick a starting position that is far from the center of the posterior's density.
\item This Gibbs sampler requires us to specify the upper and lower bounds of $\theta_L, \theta_R$ and $\rho$ before we begin.
\item This Gibbs sampler can get stuck in local modes rendering our entire inferential procedure inaccurate.
\item This Gibbs sampler will provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$ after a sufficient burn-in number of samples are dropped.
\item This Gibbs sampler will provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$ after a sufficient burn-in number of samples are dropped and the samples are thinned  to eliminate autocorrelation among the iterations of the sampler.
\item The conditional distributions tell us how many total samples to run in the sampler.
\item This Gibbs sampler requires one or more grid sampling step(s).
\item Sampling $I_i$ from its conditional distribution is impossible since it is not a continuous random variable.
\item Since the dimension of the parameter space (i.e. the number of parameters) is large, this Gibbs sampler cannot provide accurate inference.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [4min] We employ the Gibbs sampler specified previously to provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$. We run $S=100,000$ samples. We plot the first 850 below where the top plot is the chain for $\theta_L~|~X$, the middle plot is the chain for $\theta_R~|~X$ and the bottom plot is the chain for $\rho~|~X$. The chains for $I_1~|~X, \ldots, I_G~|~X$ are not displayed.

\begin{figure}[h]
\centering
\includegraphics[width=7in]{burn}
\end{figure}

\benum\subquestionwithpoints{4} Where should we burn-in the chain? Select the best answer below:

\begin{enumerate}[(a)]
\item 10
\item 380
\item 750
\item never
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [4min] \ingray{We employ the Gibbs sampler specified previously to provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$. We run $S=100,000$ samples.} We appropriately burned in. Now we wish to thin the chain. Below are autocorrelation plots. The top plot is the chain for $\theta_L~|~X$, the middle plot is the chain for $\theta_R~|~X$ and the bottom plot is the chain for $\rho~|~X$. The chains for $I_1~|~X, \ldots, I_G~|~X$ are not displayed.

\begin{figure}[h]
\centering
\includegraphics[width=7in]{thin}
\end{figure}

\benum\subquestionwithpoints{4} What multiple of the chain samples should we thin? Select the best answer below:

\begin{enumerate}[(a)]
\item 10
\item 100
\item 250
\item never
\end{enumerate}\eenum\instr\pagebreak

\problem [6min] \ingray{We employ the Gibbs sampler specified previously to provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$. We run $S=100,000$ samples.} We appropriately burned and thinned and now we provide histograms for the marginal posteriors.  Below is a plot for $\theta_L$.

\begin{figure}[h]
\centering
\includegraphics[width=7in]{theta1s}
\end{figure}

\vspace{-1cm}
\benum\subquestionwithpoints{12} \recordletters

\begin{enumerate}[(a)]
\item The above approximates $\cprob{\theta_L}{X, \theta_R, \rho, I_1, \ldots, I_G}$
\item The above approximates $\cprob{\theta_L}{X, \theta_R, \rho}$
\item The above approximates $\cprob{\theta_L}{X}$
\item The MMSE for $\theta_L$ is approximately 0.15
\item The MMSE for $\theta_L$ is approximately 0.20
\item The MMSE for $\theta_L$ is approximately 0.22
\item The MMSE for $\theta_L$ is equal to the MMAE for $\theta_L$.
\item The MMSE for $\theta_L$ is larger than the MMAE for $\theta_L$.
\item A 95\% credible region for $\theta_L$ is impossible to estimate from this plot alone.
\item This plot alone will allow us to test if $\theta_L \neq \theta_R$.
\item If you are testing if $\theta_L > 0.15$, the p value would be small and the null likely rejected.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [6min] \ingray{We employ the Gibbs sampler specified previously to provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$. We run $S=100,000$ samples. We appropriately burned and thinned and now we provide histograms for the marginal posteriors.} Below is a plot for $\rho$.

\begin{figure}[h]
\centering
\includegraphics[width=7in]{rhos}
\end{figure}

\vspace{-1cm}
\benum\subquestionwithpoints{5} \recordletters

\begin{enumerate}[(a)]
\item The above approximates $\cprob{\rho}{X}$
\item A 95\% credible region for $\rho$ would range from 0.1 to 0.9.
\item The main conclusion here is that $\rho$ cannot be estimated well.
\item The MMSE for $\rho$ is nearly equal to the MMAE for $\rho$.
\item Based on the plot above, estimates for most of the $I_i$'s will be ambiguous.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [10min] \ingray{We employ the Gibbs sampler specified previously to provide $\iid$ samples from the posterior $\cprob{\theta_L, \theta_R, \rho, I_1, \ldots, I_G}{X}$. We run $S=100,000$ samples. We appropriately burned and thinned and now we provide histograms for the marginal posteriors.}  Below is a plot for each $\theta_L$ sample subtracted from each $\theta_R$ sample.

\begin{figure}[h]
\centering
\includegraphics[width=7in]{thetaLminusthetaRs}
\end{figure}

\vspace{-1cm}
\benum\subquestionwithpoints{10} \recordletters

\begin{enumerate}[(a)]
\item The above plot approximates $\cprob{\theta_R - \theta_L}{X}$.
\item The above plot tells us that more likely than not $\rho < 50\%$.
\item The main conclusion here is that $\rho$ cannot be estimated well.
\item This plot alone will allow us to test if $\theta_R \neq \theta_L$.
\item The null hypothesis that $\theta_R = \theta_L$ will result in a p-value estimated to be $\approx 0$.
\item The null hypothesis that $\theta_R = \theta_L$ will result in a p-value estimated to be $= 0$.
\item One can conclude from this plot that this batter is better at batting rightie than leftie.
\item One can conclude from this plot that this batter has about a 14\% higher probability of getting a hit when batting rightie than leftie.\\

The $I_1$ distribution after burning and thinning is 14 0's and 343 1's.

\item The probability that the batter bat leftie for game \#1 is about 96\%.
\item The best guess as to his batting orientation for game \#1 is leftie.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [4min] \ingray{ Imagine the batter bats both leftie and rightie (both sides of the oncoming ball). The propensity to get a hit when batting leftie is $\theta_L$ and the propensity to get a hit on when batting rightie is $\theta_R$. He bats leftie $\rho$ proportion of the games. Let $I_i$ be the indicator variable indicating if he bats leftie for the $i$th game (it is equal to 1 when he bats leftie and equal to 0 if he bats rightie). There are $n$ independent at bats per game and $G$ independent total games per season and both $n$ and $G$ are known. The data $x_1, \ldots, x_G$ are number of hits per game. All other quantities are unknown.  All sum signs are indexed from $1, \ldots, G$.} Here is a histogram of the original data for the $G = 300$ games:

\begin{figure}[h]
\centering
\includegraphics[width=7in]{xs}
\end{figure}

\vspace{-1cm}
\benum\subquestionwithpoints{10} \recordletters

\begin{enumerate}[(a)]
\item This data indicates that our model formulation $\mathcal{F}$ must be incorrect.
\item This data indicates that a betabinomial model may be appropriate.
\item If the model is correctly formulated, this data shows that $\theta_L$ and $\theta_R$ are similar.
\item If the model is correctly formulated, this data shows that $\rho$ is difficult to estimate.
\item If the model is correctly formulated, this data shows that the $I_i$'s are difficult to estimate.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [17min] Let $\mathcal{F}: \iid \normnot{\theta}{\sigsq}$ with both $\theta$ and $\sigsq$ unknown.

\benum\subquestionwithpoints{20} \recordletters

\begin{enumerate}[(a)]
\item The prior $\prob{\theta, \sigsq}$ being normal is conjugate to the posterior which is normal.
\item The prior $\prob{\theta, \sigsq}$ being normal-inverse-gamma is conjugate to the posterior which is normal.
\item The prior $\prob{\theta, \sigsq}$ being normal-inverse-gamma is conjugate to the posterior which is normal-inverse-gamma.
\item The prior $\prob{\theta, \sigsq} \propto 1$ is conjugate.
\item The prior $\prob{\theta, \sigsq} \propto 1/{\sigsq}$ is conjugate.
\item The prior $\cprob{\theta}{\sigsq}\prob{\sigsq}$ is always conjugate.
\item The prior $\prob{\theta}\prob{\sigsq}$ is always semi-conjugate.
\item The prior $\cprob{\theta}{\sigsq}\prob{\sigsq}$ is conjugate only if $\cprob{\theta}{\sigsq} = \normnot{\mu_0}{\sigsq / n_0}$ and $\prob{\sigsq}$ is inverse gamma.
\item The prior $\cprob{\theta}{\sigsq}\prob{\sigsq}$ is conjugate only if $\cprob{\theta}{\sigsq} = \normnot{\mu_0}{\tausq}$ and $\prob{\sigsq}$ is inverse gamma where $\tausq$ is a constant.
\item A conjugate prior will yield a posterior kernel $k(\theta, \sigsq\,|\,X) = \tothepow{\sigsq}{-\alpha - 1} e^{-(\beta + \lambda \squared{\theta - \mu_0}) / \sigsq}$ where $\alpha, \beta, \lambda, \mu_0$ are constants which do not depend on $\theta$ or $\sigsq$. \\

Regardless of whether (j) was true, assume this kernel for the rest of the problem.

\item If $k(\theta, \sigsq\,|\,X)$ is factored into $k(\theta|\,X, \sigsq) k(\sigsq\,|\,X)$ then $k(\theta|\,X, \sigsq) \propto$ a normal.
\item If $k(\theta, \sigsq\,|\,X)$ is factored into $k(\theta|\,X, \sigsq) k(\sigsq\,|\,X)$ then $k(\theta|\,X, \sigsq)$ is a kernel for no known random variable.
\item If $k(\theta, \sigsq\,|\,X)$ is factored into $k(\theta|\,X, \sigsq) k(\sigsq\,|\,X)$ then $k(\sigsq|\,X) \propto$ an inverse gamma distribution.
\item If $k(\theta, \sigsq\,|\,X)$ is factored into $k(\theta|\,X, \sigsq) k(\sigsq\,|\,X)$ then $k(\sigsq|\,X)$ is a kernel for no known random variable.
\item It can be shown that $\int_0^\infty k(\theta, \sigsq\,|\,X) d\sigsq \propto$ a normal distribution.
\item It can be shown that $\int_0^\infty k(\theta, \sigsq\,|\,X) d\sigsq \propto$ a students $T$ distribution.
\item It can be shown that $\int_0^\infty k(\theta, \sigsq\,|\,X) d\sigsq \propto$ an inverse gamma distribution.

\item It can be shown that $\int_\reals k(\theta, \sigsq\,|\,X) d\theta \propto$ a normal distribution.
\item It can be shown that $\int_\reals k(\theta, \sigsq\,|\,X) d\theta \propto$ a students $T$ distribution.
\item It can be shown that $\int_\reals k(\theta, \sigsq\,|\,X) d\theta \propto$ an inverse gamma distribution.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\problem [7min] Let $\mathcal{F}: \iid \poisson{\theta}$. Let $\prob{\theta} = \gammanot{\alpha}{\beta}$,  $X_*$ represent the future observation(s) and $n_*$ represent the number of future observation(s).

\benum\subquestionwithpoints{12} \recordletters

\begin{enumerate}[(a)]
\item $\cprob{X}{\theta} = \cprob{X_1}{\theta} \cdot \cprob{X_2}{\theta} \cdot \ldots \cdot  \cprob{X_n}{\theta}$.
\item The prior is conjugate.
\item The prior is proper regardless of the values of $\alpha$ and $\beta$.
\item The posterior predictive distribution $\cprob{X_*}{X}$ is always negative binomial.
\item $\cprob{X_*}{X}$ is only negative binomial if $n_* = 1$.
\item $\cprob{X_*}{X}$ is only negative binomial if $n_* > 1$.\\

Assume $n_* = 10$ for the remainder of this problem.

\item To sample one $X_*$, we first need to draw $\theta_{\text{samp}}$, a sample from $\cprob{\theta}{X}$.
\item To sample one $X_*$, we first need to draw $\theta_{\text{samp}}$, a sample from $\prob{\theta}$.
\item To sample one $X_*$, we then draw $X_{\text{samp}, 1}, X_{\text{samp}, 2}, \ldots, X_{\text{samp}, n}$ values independently using \texttt{rpois}($\theta_{\text{samp}}$).
\item To sample one $X_*$, we then draw $X_{\text{samp}, 1}, X_{\text{samp}, 2}, \ldots, X_{\text{samp}, 10}$ values independently using \texttt{rpois}($\theta_{\text{samp}}$).
\item Regardless of the method used to sample one $X_*$, the components of $X_*$ are all independent of each other.
\item To sample many $X_*$'s, we repeat the procedure of correctly drawing $\theta_{\text{samp}}$ and then correctly drawing $X_*$ over and over again.
\end{enumerate}\eenum\instr\pagebreak
%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}