代写 statistic MA 568 – Statistical Analysis of Point Process Data Solutions to Problem Set 2

MA 568 – Statistical Analysis of Point Process Data Solutions to Problem Set 2
% Question 1
load M1_spikes
plot(T,spikes); plot(X,Y,X(spiketimes),Y(spiketimes),’r.’); plot(phi(spiketimes),V(spiketimes),’r.’);
1
0.5
0
-75
-80
-85
0
1000
2000
3000
4000 5000 6000 7000 8000
Time (ms)
15
10
5
0.05 0.045 0.04 0.035 0.03 0.025 0.02 0.015 0.01 0.005 0
This occupancy normalized histogram suggests that the neuron fires most when the animal is moving approximately 1-1.5 radians relative to movement to the right, at a rate of approximately 55 Hz.
0
x-coordinate (cm) Direction (radians)
% Question 2
dirs = -pi:.5:pi;
onh = hist(phi(spiketimes),dirs)./hist(phi,dirs); bar(dirs,onh);
-90
125 130 135 140 -4 -2 0 2 4
-3 -2 -1 0 1 2 3 Direction (radians)
y-coordinate (cm)
Speed (cm/sec)

page 2: MA 568 – Solutions to Problem Set 2
% Question 3
phis = -pi:.05:pi;
lambda = 30+30*V*ones(size(phis))/16.1.*cos(phi*ones(size(phis))- ones(size(phi))*phis);
L=spikes’*log(lambda*1e-3)-
ones(size(spikes’))*lambda*1e-3;
plot(phis,L);
MLind = find(L==max(L)); phi_ML = phis(MLind)
>> phi_ML = 1.0584
-1060 -1070 -1080 -1090 -1100 -1110
se = 1/sqrt(-(L(MLind+1)-2*L(MLind)+L(MLind -1))/5e-2/5e-2); CI = [phi_ML-1.96*se phi_ML+1.96*se]
>> CI = 0.6784 1.4384
% Question 4
lambda_ML = 30+30*V/16.1.*cos(phi-phi_ML); plot(T,lambda_ML,T,spikes)
-3 -2 -1 0 1 2 3 Direction (radians)
50 40 30 20 10
0
0 1000
2000 3000
4000 5000 Time (ms)
6000 7000 8000
% Question 5
spikeInd = find(spikes);
ISIs = diff([0; spikeInd]); hist(ISIs,50);
lambdaInt = cumsum(lambda_ML)*1e-3; Z = diff([0; lambdaInt(spikeInd)]); hist(Z,50);
[Femp xs] = ecdf(Z); Fm = expcdf(xs, 1); n = length(Z);
25 20 15 10
5
0 0123456
Rescaled ISI
Counts
Estimated rate (Hz)
Likelihood

page 3: MA 568 – Solutions to Problem Set 2
plot(Femp,Fm,Fm,Fm+1.36/sqrt(n),’k:’,Fm,Fm-1.36/sqrt(n),’k:’); axis([0 1 0 1]);
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0
0 0.2 0.4 0.6 0.8 1 Empirical CDF
1 0.8 0.6 0.4 0.2 0
-50 -40 -30 -20 -10 0 10 20 30 40 50 Lag
% Question 6 plot(-236:236,xcorr(Z-mean(Z),’coef’),’.’); line([-236 236],[1.96/sqrt(n) 1.96/sqrt(n)]); line([-236 236],[-1.96/sqrt(n) -1.96/sqrt(n)]);
% Question 7
rescaledTimes = cumsum(Z);
spikes = hist(rescaledTimes,0:rescaledTimes(end)); FF = var(spikes)/mean(spikes)
>> FF = 0.8936
FF_CI = gaminv([.025 .975],length(spikes)/2,2/length(spikes)) >> FF_CI = 0.8298 1.1859
The sample Fano factor lies within the 95% confidence interval, so we cannot preclude an inhomogeneous Poisson model based on this binning of the data.
% Question 8
The model passes the KS test and the correlation structure in the rescaled ISIs does not appear to be significant. This suggests that this inhomogeneous Poisson model is able to describe well the statistical structure of this brief segment of data.
The model fit suggests that this neuron is cosine tuned, with a preferred direction about 1.05 radians from the horizontal, and modulated by movement speed.
Model CDF
Correlation coefficient