\documentclass[11pt]{article}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}   % General awesomeness???
\usepackage{hyperref}
\usepackage{multirow}

\textwidth=6.5in
\textheight=9.0in
\oddsidemargin=0.0in
\evensidemargin=0.0in
\topmargin=0.0in
\headheight=0.0in
\headsep=0.0in
\parskip=0.0in
\parindent=0.0in

% Spacing commands
    \newcommand{\tab}{\hspace{0.5in}}
    \newcommand{\tib}{\hspace{0.1in}}
    \newcommand{\vib}{\vspace{0.15in}}


% Statistics function commands
    \newcommand{\prob}[1]{\operatorname{Pr} \left[ #1 \right]}
    \newcommand{\pdf}[2][]{f_{ #1 } \left( #2 \right)}
    \newcommand{\cdf}[2][]{F_{ #1 } \left( #2 \right)}
    \newcommand{\E}[2][]{\operatorname{E}_{ #1 } \! \left[ #2 \right]}
    \newcommand{\Var}[2][]{\operatorname{Var}_{ #1 } \! \left[ #2 \right]}
    \newcommand{\Cov}[2]{\operatorname{Cov} \left[ #1, #2 \right]}
    \newcommand{\info}[1]{\mathscr{I} \!\! \left( #1 \right)}

    \newcommand{\dBern}[1]{{\operatorname{Bern} \left( #1 \right)}}
    \newcommand{\dBeta}[2]{{\operatorname{Beta} \left( #1, #2 \right)}}
    \newcommand{\dBin}[2]{{\operatorname{Bin} \left( #1, #2 \right)}}
    \newcommand{\dCauchy}[1]{{\operatorname{Cauchy} \left( #1 \right)}}
    \newcommand{\dChiSq}[1]{{\chi^2 \left( #1 \right)}}
    \newcommand{\dDch}[3]{{\operatorname{Dirichlet} \left( #1, #2, #3 \right)}}
    \newcommand{\dExp}[1]{{\operatorname{Exp} \left( #1 \right)}}
    \newcommand{\dGamma}[2]{{\operatorname{Gamma} \left( #1, #2 \right)}}
    \newcommand{\dGeom}[2]{{\operatorname{Geom} \left( #1, #2 \right)}}
    \newcommand{\dMulti}[2]{{\operatorname{Mult} \left( #1, #2 \right)}}
    \newcommand{\dNegBin}[2]{{\operatorname{NegBin} \left( #1, #2 \right)}}
    \newcommand{\dNorm}[3][]{{\operatorname{N}_{ #1 } \! \left( #2, #3 \right)}}
    \newcommand{\dPois}[1]{{\operatorname{Pois} \left( #1 \right)}}
    \newcommand{\dUnif}[2]{{\operatorname{Uniform} \left( #1, #2 \right)}}
    \newcommand{\dWeib}[2]{{\operatorname{Weibull} \left( #1, #2 \right)}}


% Statistics symbol definitions and changes
    \newcommand{\iid}{\stackrel{\mathrm{iid}}{\sim}}
    \newcommand{\indep}{\perp\!\!\!\perp}
    \newcommand{\indepSim}{\stackrel{ind}{\sim}}
    \newcommand{\cLaw}{\stackrel{\mathscr{L}}{\longrightarrow}}
    \newcommand{\cProb}{\stackrel{\mathscr{P}}{\longrightarrow}}
    \newcommand{\cAS}{\stackrel{\mathrm{a.s.}}{\longrightarrow}}

    \renewcommand{\bar}{\overline}

% Mathematics symbol definitions and changes
    \newcommand{\rfrac}[2]{{}^{#1}\!/_{#2}}
    \newcommand{\kronecker}{\otimes}
    \newcommand{\tr}[1]{\operatorname{tr} \left( #1 \right)}
    \newcommand{\logit}[1]{\operatorname{logit} \left( #1 \right)}
    \newcommand{\logistic}[1]{\operatorname{logistic} \left( #1 \right)}
    \newcommand{\expit}[1]{\operatorname{expit} \left( #1 \right)}
    \newcommand{\Real}{\rm I\!R}
    \newcommand{\nin}{\not\in}

    \renewcommand{\d}{\partial}
    \renewcommand{\ln}{\ell n}
    \renewcommand{\approx}{\simeq}
    \newcommand{\appx}{\simeq}


% Greek alphabet changes
    \newcommand{\vep}{\epsilon}
    \newcommand{\vphi}{\varphi}
    \newcommand{\vtheta}{\vartheta}
    \renewcommand{\epsilon}{\varepsilon}

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{(\alph{enumii})}




\begin{document}

    \begin{center}
        {\Large \sc Stats 579 -- Intermediate Bayesian Modeling}\\
        \vspace{0.25in}
        {\Large Assignment \# 3}\\
    \end{center}

    \vspace{0.2in}

    \begin{enumerate}

        \item An hypothetical study considers the lifespan of fluorescent light bulbs. Let $y_1, ..., y_n$ be the duration (in years) it takes for each of $n$ light bulbs to fail. Assume that all tests are performed under laboratory conditions and observations are {\em iid}. Researchers are interested in whether bulb lifespan is better modeled with model $M_1$, an $\dExp{\lambda}$ distribution, or with model $M_2$, a $\dWeib{3}{\lambda}$ distribution. For both models, the researchers assume $p(\lambda) = e^{-\lambda}$.\\

            For this problem, please use the Exponential and Weibull parameterizations from your textbook, which give
            \begin{align*}
                y_E &\sim \dExp{\lambda}\\
                f(y_E \mid \lambda) &= \lambda \exp \left( - \lambda y \right) I_{(0, \infty)} (y)\\
                y_W &\sim \dWeib{\alpha}{\lambda}\\
                f(y_W \mid \alpha, \lambda) &= \lambda \alpha y^{\alpha - 1} \exp \left( - \lambda y^{\alpha} \right) I_{(0, \infty)} (y)
            \end{align*}

            \begin{enumerate}
                \item Obtain the marginal density for these data under each model. (HINT: Take advantage of conjugacy.)
                \item Obtain an expression for the Bayes factor comparing $M_1$ to $M_2$.
                \item Evaluate the Bayes factor when the data are: $\{ 8.05, 6.56, 3.20, 6.85, 5.67 \}$.
                \item Explain which model seems preferable based on the Bayes factor. Explain which model would be preferable if you had a prior belief that $M_1$ were nine times more likely to be correct than $M_2$.
            \end{enumerate}

        \item Using the same set-up as in Problem 1, the researchers want to compare these models in terms of AIC.
            \begin{enumerate}
                \item Find the MLE for $\lambda$ under $M_1$ and $M_2$. Note that although both models have a parameter named $\lambda$, these parameters are not the same and may maximize at different values for each model. It may be helpful to write the MLEs as $\hat{\lambda}_1$ and $\hat{\lambda}_2$ to help distinguish them.
                \item Calculate AIC for each model using the data provided above. Which model seems preferable based on AIC?
            \end{enumerate}

    \item Let $y_1, ..., y_n$ be independent conditional on some model parameter $\theta$. Let $y_i \sim f(y_i \mid \theta)$ and let $\theta$ have prior $p(\theta)$. Consider the conditional predictive ordinate for an observation $y_j$,
        $$CPO_j = f \left( y_j \mid y_{(j)} \right),$$
        where $y_{(j)}$ denotes the set $\{y_1, ..., y_{j-1}, y_{j+1}, ..., y_n\}$.
        \begin{enumerate}
            \item Show that $$CPO_j = \frac{\int \prod_{i=1}^n f(y_i \mid \theta) p(\theta)}{\int \prod_{i \neq j} f(y_i \mid \theta) p(\theta)}.$$
            \item Now show that $$CPO_j^{-1} = \int \left[ \frac{1}{f(y_j \mid \theta)} \right] p(\theta \mid y) d\theta.$$
        \end{enumerate}

    \end{enumerate}

\end{document} 