\documentclass[addpoints, 12pt]{exam}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bbm}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    urlcolor=blue,
}
\usepackage{listings}
\usepackage{url}
\usepackage{xurl}
\usepackage{xcolor,framed}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{answer}{Answer}
\usepackage{url}
\usepackage{multicol}
\usepackage[T1]{fontenc}  
\usepackage{tcolorbox}
\usepackage{hyperref}
\usepackage{subfigure}
\hypersetup{
    colorlinks=true,
    filecolor=blue}
\newtcolorbox{bigbox}[3][]
{
  colframe = #2!25,
  colback  = #2!10,
  coltitle = #2!20!black,  
  title    = {#3},
  #1,
}
\usepackage{xcolor,framed}

\newenvironment{selectone}
    {
    \renewcommand\choicelabel{$\bigcirc$ \Alph{choice}.}
    \begin{choices}
    }
    {
    \end{choices}
    \renewcommand\choicelabel{\Alph{choice}.}
    }

% Header
\newcommand{\lecture}[4]{
    \def \printtitle {
    \ifprintanswers
    #1~Solutions
    \else
    #1
    \fi
    }
	\pagestyle{myheadings}
	\thispagestyle{plain}
	\newpage
	\setcounter{page}{1}
	\noindent
	\begin{center}
		\framebox{
			\vbox{\vspace{2mm}
				\hbox to 6.28in { {\bf Data 100, Spring 2025
						\hfill #4} }
				\vspace{6mm}
				\hbox to 6.28in { {\Large \hfill \printtitle{}  \hfill}  }
				\vspace{6mm}
				\hbox to 6.28in { {\it  #2 \hfill #3} }
				\vspace{2mm}}
		}
	\end{center}
	\markboth{#1}{#1}
	%\vspace*{-2mm}
}

\definecolor{shadecolor}{gray}{0.95}

\newcommand{\duedate}{Thursday, April 10th, 11:59 PM PT}

\begin{document}

\lecture{Homework 6 Statistics}{}{Due Date: \duedate{}}{}

\vspace*{-2em}

\fullwidth{\section*{Submission Instructions}}
\noindent You must submit this assignment to Gradescope by 
the on-time deadline, \textbf{\duedate{}}. Please read the syllabus for \textbf{the Slip Day policy}. No late submissions beyond the Slip Day policy will be accepted unless additional accommodations have been arranged prior. While course staff is happy to help you if you encounter difficulties with submission, we may not be able to respond to last-minute requests for assistance (TAs need to sleep, after all!). \textbf{We strongly encourage you to plan to submit your work to Gradescope several hours before the stated deadline.} This way, you will have ample time to contact staff for submission support. \\

\noindent There are two parts to this assignment listed on Gradescope:
\begin{itemize}
\item \textbf{Homework 6 Coding}: Submit your Jupyter Notebook zip file for Homework 6, which can be generated and downloaded from DataHub using the \texttt{grader.export()} cell provided.
\item \textbf{Homework 6 Coding Written}: Gradescope will automatically submit the PDF from the zip file submitted earlier. You do not need to submit anything to this assignment yourself, but \textbf{you are responsible} for checking that it is submitted properly.
\item \textbf{Homework 6 Statistics}: Submit a PDF to Gradescope that contains all your answers to all questions in Homework 6 (Statistics).
\end{itemize}

\noindent  To receive credit on this assignment, \textbf{you must submit both your coding and written portions to their respective Gradescope portals}.\\ 

\noindent You can answer the below Homework 6 Statistics questions in one of many ways: 
\begin{enumerate}
    \item Type your answers. We recommend LaTeX, the math typesetting language. Overleaf is a great tool to type in LaTeX.
    \item Download this PDF, print it out, and write directly on these pages. If you have a tablet, you may save this PDF and write directly on it.
    \item Write your answers on a blank sheet of physical or digital paper. Note: If you write your answers on physical paper, use a scanning application (e.g., CamScanner, Apple Notes) to generate a PDF.
\end{enumerate}

\noindent \textbf{Important}: When submitting Homework 6 (Statistics) on Gradescope, you \textbf{must tag pages to each question correctly} (it prompts you to do this after submitting your work). This significantly streamlines the grading process for our readers. Failure to do this may result in a score of 0 for untagged questions.\\

\noindent \textit{You are responsible for ensuring your submission follows our requirements and that the automatic submission for Homework 6 Coding Written answers went through properly. We will not be granting regrade requests nor extensions to submissions that don't follow instructions.} If you encounter any difficulties with submission, please don't hesitate to contact staff before the deadline.

\vspace{.5in}

\fullwidth{\section*{Collaboration Policy}}
\noindent Data science is a collaborative activity. While you may talk with others about the homework, we ask that you write your solutions individually. If you discuss the assignments with others, please include their names below.

\vspace{.25in} 
\newpage


\fullwidth{\section*{Homework 6 Manually Graded Questions}}

\begin{itemize}[leftmargin=0.3in]
  \item This is not a question. This is a reminder to check and make sure that your Homework 6 Coding Written (manually graded questions) have been automatically submitted as a PDF by Gradescope when the HW 6 Coding assignment is submitted.
\end{itemize}

\noindent \hrulefill

\begin{questions}

\fullwidth{\section*{From Bernoulli to Geometric Variables}}
\question[9] Let $X_i \stackrel{\text{iid}}{\sim} \text{Bernoulli}(p)$, where $p \in [0,1]$.
\vspace{.2in}

\textit{For this problem, you may find it helpful to review the fundamental rules of probability from  \href{https://inferentialthinking.com/chapters/09/5/Finding_Probabilities.html}{Chapter 9.5 of the DATA C8 Textbook}.}
\vspace{.2in}

\begin{parts}

\part[1] Compute $P(X_1=1)$.

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}

\part[1] Compute $P(X_1=1, X_2 = 1)$. 

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}

\part[1] Compute $P(X_1=1, X_2 = 1, X_3=0)$.

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}
\part[2] Compute $P(X_1=1, X_2=1,\dots, X_n = 1, X_{n+1} = 0)$.
Express your answer in terms of $n$ and $p$.

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}
\part[2] Suppose you flip a coin repeatedly until you observe a single tail.
For example, you might have a streak of two heads before you see a tail (H,H,T).
A geometric RV Y represents the \textbf{number of heads} you observe in a series of coin flips until you observe the \textbf{first} tail.
\vspace{.1in}
\begin{enumerate}[label=(\roman*)]
    \item What are the possible values of Y? \\

    \textit{Hint: As a starting point, you might think about the (H,H,T) scenario presented above, where $P(Y=2)$.}
    
\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}
    
    \item Suppose a particular coin has $P(\text{Heads})=p$. Derive $P(Y = y)$ in terms of $p$ and $y$. \\
    \\
    \textit{Hint: You might start by computing $P(Y=2)$ for the (H,H,T) scenario.}

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}
    
\end{enumerate}

\part[2] The U.S.\ stock market has a positive return on $53\%$ of trading days. For this problem, assume the positive or negative sign of daily stock market returns are i.i.d.\ Bernoulli RVs with $p=0.53$. \\

What is the probability of observing a consecutive positive gain streak of five or more trading days, starting from the first trading day after this HW is due? For example, if the first trading day after the due date has a positive return, but the following day has a negative return, we would have a streak length of one day. \\

\textit{Note: For full credit, your answer cannot include an infinite sum. But, you can leave your answer as an unsimplified algebraic expression. For example, $(0.3)^3(0.5)^4+10$}

\begin{shaded}
\begin{answer}

% YOUR ANSWER HERE %

\end{answer}
\end{shaded}
\end{parts}


\end{questions}

\end{document}

