Question: Please help code in python. Thank you. Recall the probability mass function for a Poisson distributed random variable is p(y)=y!ye Where y takes on a

Please help code in python. Thank you.

Please help code in python. Thank you. Recall the probability mass functionfor a Poisson distributed random variable is p(y)=y!ye Where y takes ona value of all integers (i.e. 0,1,2, ) This pmf is used

Recall the probability mass function for a Poisson distributed random variable is p(y)=y!ye Where y takes on a value of all integers (i.e. 0,1,2, ) This pmf is used often to describe 'count' data, like clicks on a webpage or spikes from a neuron in a given time frame. Let's consider a scenario where a neuron is firing at a given rate, where that rate is equal to the parameter of the Poisson distribution. We'll start by setting that parameter to 0.05 and generating some data [ ] T =1000# number of ms timebins (one second full recording time) spike_data = np.random.poisson(lam =0.05, size =T ) plt.plot(spike_data,'+') plt.xlabel('time') plt.Ylabel('spike count') [ ] Textro. 0.5. 'snike rount' Of course, in practice, we will only have access to the above data, and we won't know the true underlying model that generated it! Let us pretend that is the case here. For these data, let's follow a similar procedure as above to estimate the rate of the neuron. Here, we are interested in finding the maximum likelihood estimate of the lambda parameter. First, go through: and make sure you understand the logic the formulation of the log-likelihood for data under the Poisson distribution. Write a function that will take in the data above, and an estimate of the parameter lambda, and return the log-likelihood for this model [ ] def pois_ll(spike_data, lam_hat): \#return the log-likelihoood of the data under the poisson model Plot the log-likelihood as a function of varying values of the parameter lambda to confirm your estimate of the overall firing rate of the neural data. (Remember the true parameter is a very small value so only consider a narrow range of lambas around this very small value to see the maximum!)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!