lfex1.m 1009 B

1234567891011121314151617181920212223242526
  1. % Local Estimation a spike firing rate (in spikes per unit time).
  2. %
  3. % The estimation procedure approximates the log of the spike firing
  4. % rate by a quadratic polynomial, within a sliding window.
  5. %
  6. % The first argument to locfit() is a column vector of the spike times.
  7. % 'family','rate' specifies that the output of the density estimate should
  8. % be in terms of events per unit time. (instead of the default, statistical
  9. % density estimation).
  10. %
  11. % 'alpha',0.6 specifies the width of the sliding windows, as a fraction of
  12. % the total spikes.
  13. %
  14. % xlim gives the limits of the observation interval. Correct specification
  15. % of this is critical to avoid introducing bias at end-points.
  16. %
  17. % The lfband(fit) line adds confidence bands (based on pointwise 95%
  18. % coverage) to the plot.
  19. %
  20. % The spike time data is from Hemant Bokil.
  21. load lmem5312.mat;
  22. fit = locfit(data(6).times{1},'xlim',[78.9 80.30],'family','rate','nn',0.6);
  23. lfplot(fit);
  24. title('Spike Firing Rate Estimation');
  25. lfband(fit);