Q-2(40 points):

A) 20 points

Let X = amount of time (in minutes) a ice cream man gets a new customer at his cart. The time is known to have an exponential distribution with the average amount of time between a new customer being four minutes.

Q-1 Plot the probablity density function of the exponential distribution of this ice cream man getting a customer every 4 minutes.

You may use the Python libraries to calculate the exponential distribution and to plot. https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.expon.html

B) 20 points

Now assume on a very hot day the ice cream man gets X customers and each new customer comes every 4 minutes.

Q-1 Generate X samples from the exponential distribution where X = 200 and the rate = 4.

Q-2 Plot the samples on a graph to show how they look graphically. Does it look similar to the graph above?

Q-3 (30 points)

Assume that you are given the customer data generated in Part 1, implement a Gradient Descent algorithm from scratch that will estimate the Exponential distribution according to the Maximum Likelihood criterion.

Answer the following:

  1. Plot the negative log likelihood of the exponential distribution. (10 points)
  2. What is the lambda MLE of the generated data? (10 points)
  3. Plot the estimated lambda vs iterations to showcase convergence towards the true lambda (10 points)

Read this article to obtain the likelihood and negative log likelihood function of the exponential distribution: https://www.statlect.com/fundamentals-of-statistics/exponential-distribution-maximum-likelihood