# lfex1

## PURPOSE

Local Estimation a spike firing rate (in spikes per unit time).

## SYNOPSIS

This is a script file.

## DESCRIPTION

     Local Estimation a spike firing rate (in spikes per unit time).

     The estimation procedure approximates the log of the spike firing
     rate by a quadratic polynomial, within a sliding window.

     The first argument to locfit() is a column vector of the spike times.
     'family','rate' specifies that the output of the density estimate should
     be in terms of events per unit time. (instead of the default, statistical
     density estimation).

     'alpha',0.6 specifies the width of the sliding windows, as a fraction of
     the total spikes.

     xlim gives the limits of the observation interval. Correct specification
     of this is critical to avoid introducing bias at end-points.

     The lfband(fit) line adds confidence bands (based on pointwise 95%
     coverage) to the plot.

     The spike time data is from Hemant Bokil.

## CROSS-REFERENCE INFORMATION

This function calls:

- lfband adds confidence bands around the plot of a locfit() fit.
- lfplot Plot (for one or two dimensions) a locfit() fit.
- locfit Smoothing noisy data using Local Regression and Likelihood.

This function is called by:

## SOURCE CODE

    0001 % Local Estimation a spike firing rate (in spikes per unit time).
    0002 %
    0003 % The estimation procedure approximates the log of the spike firing
    0004 % rate by a quadratic polynomial, within a sliding window.
    0005 %
    0006 % The first argument to locfit() is a column vector of the spike times.
    0007 % 'family','rate' specifies that the output of the density estimate should
    0008 % be in terms of events per unit time. (instead of the default, statistical
    0009 % density estimation).
    0010 %
    0011 % 'alpha',0.6 specifies the width of the sliding windows, as a fraction of
    0012 % the total spikes.
    0013 %
    0014 % xlim gives the limits of the observation interval. Correct specification
    0015 % of this is critical to avoid introducing bias at end-points.
    0016 %
    0017 % The lfband(fit) line adds confidence bands (based on pointwise 95%
    0018 % coverage) to the plot.
    0019 %
    0020 % The spike time data is from Hemant Bokil.
    0021
    0022 load lmem5312.mat;
    0023 fit = locfit(data(6).times{1},'xlim',[78.9 80.30],'family','rate','nn',0.6);
    0024 lfplot(fit);
    0025 title('Spike Firing Rate Estimation');
    0026 lfband(fit);