Computer problem 1

Simulate a coin toss process consisting in 500 tosses per trial over 10000 trials. Assume P(head=0.01). Compute the mean and variance of this process and plot on the same graph the sample distribution and a Poisson distribution with the same mean.

 

Exercise

You are given the following data: BABAEAACDDABABAAADAEBABBAABADAAC

 

1-Estimate the frequency of each letter and compute the entropy of this estimated distribution. What is the optimal uniquely decodable binary code given these data?

 

You are told that the data were actually generated according to the following distribution: P(A) = 0.5, P(B)=0.25, P(C)=0.125, P(D)=0.0625, P(E)=0.0625.

 

2- What would be the actual optimal uniquely decodable code? What is the optimal code length? How does it compare to the entropy of P?

3-Compute the average code length for the code in question 1 given the true distribution.

4-Compute the KL distance between the estimated and true distribution and compare to the difference between the code lengths when using the estimated vs true distribution

 

 

Computer problem 2 (optional, no deadline)

Simulate a random walk model of spiking. Compute the mean, variance, Fano factor, interspike interval distribution and CV. The details of the model can be found in:

Shadlen-Newsome