1. Let $$X_1, \ldots, X_N \sim \text{Poisson}(\lambda = 1.84)$$. The probability density function for the Poisson random variable is $f(x | \lambda) = \lambda^x e^{{-\lambda}} / x!$ for $$x \in 0, 1, 2, 3, \ldots$$ and $$\lambda > 0$$

1. By hand, calculate the simplified log-likelihood and then write the simplified log-likelihood as a Python function with signature $$\texttt{ll_poisson(l, x)}$$.

2. By hand, calculate the maximum likelihood estimator. Include a photo of your hand written solution, or type out your solution using LaTeX.

3. Create an array $$\texttt{X}$$ by generating $$N = 1001$$ Poisson random variables, with $$\lambda = 1.84$$ from above. Use $$\texttt{np.random.poisson(}\lambda \texttt{, N)}$$.

4. Use $$\texttt{scipy.optimize.minimize(ll, (l0), args=(X), method='L-BFGS-B', bounds=[...])}$$ to calculate the maximum likelihood estimate $$\hat{\lambda}$$ of $$\lambda$$.

2. Let $$X_1, \ldots, X_N \sim \text{IG}(\mu = 12.41, \lambda = 3.9)$$, named inverse Gaussian or Wald. The probability density function for the inverse Gaussian random variable is $f(x | \mu, \lambda) = \left( \frac{{\lambda}}{{2\pi x^3}} \right)^{1/2} e^{{ -\frac{{\lambda(x - \mu)^2}}{{2\mu^2x}} }}$ for $$x > 0$$, $$\mu > 0$$, and $$\lambda > 0$$.

1. By hand, calculate the simplified log-likelihood and then write the simplified log-likelihood as a Python function with signature $$\texttt{ll_ig(theta, x)}$$.

2. Create an array $$\texttt{X}$$ by generating $$N = 1001$$ IG/Wald random variables, with $$\mu = 12.41$$, $$\lambda = 3.9$$ from above. Use $$\texttt{np.random.wald(}\mu, \lambda \texttt{, N)}$$.

3. Use $$\texttt{scipy.optimize.minimize(ll, theta0, args=(X), method='L-BFGS-B', bounds=[...])}$$ to calculate the maximum likelihood estimate $$\hat{\theta}$$ of $$\theta = (\mu, \lambda)$$.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9851444363594055, "perplexity": 321.2363358232421}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-43/segments/1570986658566.9/warc/CC-MAIN-20191015104838-20191015132338-00289.warc.gz"}