```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# library(reticulate)
# py_install("matplotlib")
```



# Introduction

* Made available UCL Week 10: 4 November 2022
* Due UCL Week 12: 18 November 2022, 13:00 London Time.
* This ICA consists of four questions, worth 40 points;
  * another 5 points will be given based purely on presentation, so that the total available points is 45.  
* This ICA is worth 30 percent of your grade for this module.
* Many questions will require you to write and run R/Python code.
* The ICA must be completed in R Markdown/Juptyer Notebook and typeset using  Markdown with Latex code, just like the way our module content is generated.  You can choose to use either R or Python.
* Please hand in the html file and the Rmd/ipynb source file.
* As usual, part of the grading will depend on the clarity and presentation of your solutions.
*  You are to do this assignment by yourselves, without any help from others.
*  You are allowed to use any materials and code that was presented so far.
*  Do not search the internet for answers to the ICA.
*  Do not use any fancy code or packages imported from elsewhere.
    * For example, you should not be using a Markov chain package to generate your Markov chains.  It is not necessary to use anything other than the basic packages that were already introduced; if you have any doubt, please contact me.



##  Plagiarism and collusion

Please familarize yourself with [the following excerpt on plagiarism and collusion from the student handbook ](https://tsoo-math.github.io/ucl/Plagiarism-Collusion.pdf)


By ticking the submission declaration box in Moodle you are agreeing to the following declaration:

<br>

**Declaration:** I am aware of the UCL Statistical Science Department's regulations on plagiarism for assessed coursework. I have read the guidelines in the student handbook and understand what constitutes plagiarism. I hereby affirm that the work I am submitting for this in-course assessment is entirely my own.



## Anonymous Marking 

Please do **not** write your name anywhere on the submission. Please include only your **student number** as the proxy identifier.





# Questions


## 1.) Parameter estimation [10 points]


Let $X_1, X_2, \ldots$ be iid exponential random variables with unknown rate $\lambda>0$.  Suppose we only get to keep track of whether $X_i$ is in the unit interval or not; that is, we observe the random variables $Y_i = \mathbf{1}[ 0 \leq X_i \leq 1]$.   Find a reasonable estimator for $\lambda$ and provide justification that your estimator is good. 


##  2.) The area of a random triangle inside a disc [10 points]

Demonstrate by simulations that if three points are sampled  independently and uniformly at random inside a disc of radius $1$, then the expected area of the corresponding triangle is $\tfrac{35}{48\pi}$. 







## 3.) Markov chains [10 points]

*  Suppose $X$ is  irreducible and aperiodic finite state Markov chain on a state space $S$, containing the states $a,b$ and $c$.   Consider the associated sums given by
$$T_n:= \frac{1}{n+1} \sum_{k=0} ^n \mathbf{1}[X_{k+2} =c, X_{k+1}=b , X_{k} =a].$$
Guess the limit for $T_n$ as $n\to \infty$.  Provide evidence (not necessarily a proof) for your guess. [5 points]

*  Demonstrate your guess, via simulations, using the Markov chain with transition matrix
$$
\begin{equation*}
P = 
\begin{pmatrix}
2/6 & 3/6 & 1/6 \\
1/4 & 1/4 & 1/2 \\
1/8 & 1/4 & 5/8
\end{pmatrix}.
\end{equation*}
$$
[5 points]



## 4.) Point processes [10 points]


Consider the point process on the unit interval $[0,1]$ that is a sampled by placing $N=10$ points independently and uniformly on the interval.  Let $X$ and $Y$ be the number of points on the two disjoint halves of the interval. 

*  Are $X$ and $Y$ independent?  Explain. [3 points]
*  What is the $\mathbb{E} X$? [2 points]
*  What is the probability mass function for $X$?   [3 points]
*  What is the distribution of location of the point closest to the right endpoint of the interval? [2 points]


# Endnotes

* Version: `r format(Sys.time(), '%d %B %Y')`
  * Minor typos corrected in the index-summation for number 3.
  * The indicator function notation in Q3, has been *switched* from $\mathbf{I}$ to our usual notation with $\mathbf{1}$.
  * No coding is required for Q4; this is a "pen and paper" type exercise.
  * In Q3, an initial distribution is not specified.
  * In Q3, the first part is meant to be a "pen and paper" type exercise; in particular, you are not meant to use simulations from the next part as "supporting evidence."
* [Rmd Source](https://tsoo-math.github.io/ucl3/2022-ica1-stat9-release.Rmd)

<br>
<br>


