I'm modelling a pyramidal cell. How do I apply a poisson distributed synaptic input? I can't seem to find any information on this. NetStim has negexp distribution, not poisson. Thanks in advance.
Ted: thanks for your detailed reply to my previous question!
 FL
Poisson distributed synaptic input

 Site Admin
 Posts: 5935
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Poisson, negexp, and all that.
When neuroscientists talk about Poisson distribution, they generally mean a 1 dimensional
Poisson process, which is to say, a series of events that happen at intervals that are
described by a negative exponential probability density. The number of events that occur
over an interval of time has a Poisson distribution. See
http://planetmath.org/encyclopedia/Pois ... iable.html
and
http://en.wikipedia.org/wiki/Poisson_process
Poisson process, which is to say, a series of events that happen at intervals that are
described by a negative exponential probability density. The number of events that occur
over an interval of time has a Poisson distribution. See
http://planetmath.org/encyclopedia/Pois ... iable.html
and
http://en.wikipedia.org/wiki/Poisson_process
poisson spikes using matlab
This is the matlab code we use for generating gamma/poisson distributions. We save the times out into a text file, then import them into neuron using the netcon.event command.
I got this off the web somewhere, but unfortunately I didn't keep track of where...
function [t,s] = fastgammatrain(duration,meanrate,order)
% function [t,s] = fastgammatrain(duration,meanrate,order)
%
% returns spike train output of an integrate and fire neuron with
% a random spiking threshold which is distributed according to
% a gamma distribution of order n. n=1 gives a poisson train.
% increasing n gives increasingly regular spike trains.
%
% where
% duration = duration of spiketrain (ms)
% meanrate = mean firing rate of the spike train (spikes/s)
% order = order of the gamma distribution for resetting threshold
%
% return parameters are:
% t = vector containing the time index for spike train (ms)
% s = spike train (1's represent spikes, 0's represent no spikes)
delta_t = 0.025; % resolution of spike train in ms
t = 0:delta_t:duration;
idur=length(t);
Vrandth = gamrnd(order,1/order,1,idur);
itonextspike =round(Vrandth/(meanrate/1000*delta_t));
itonextspike = itonextspike(itonextspike > 2); % refractory period = 0.002 ms
ispikes = cumsum(itonextspike);
ispikes = ispikes(ispikes < (duration/delta_t));
nspikes = length(ispikes);
s = sparse(1,ispikes,1,1,idur,nspikes);
if (nargout == 0)
plot(t,s)
end
s = full(s);
I got this off the web somewhere, but unfortunately I didn't keep track of where...
function [t,s] = fastgammatrain(duration,meanrate,order)
% function [t,s] = fastgammatrain(duration,meanrate,order)
%
% returns spike train output of an integrate and fire neuron with
% a random spiking threshold which is distributed according to
% a gamma distribution of order n. n=1 gives a poisson train.
% increasing n gives increasingly regular spike trains.
%
% where
% duration = duration of spiketrain (ms)
% meanrate = mean firing rate of the spike train (spikes/s)
% order = order of the gamma distribution for resetting threshold
%
% return parameters are:
% t = vector containing the time index for spike train (ms)
% s = spike train (1's represent spikes, 0's represent no spikes)
delta_t = 0.025; % resolution of spike train in ms
t = 0:delta_t:duration;
idur=length(t);
Vrandth = gamrnd(order,1/order,1,idur);
itonextspike =round(Vrandth/(meanrate/1000*delta_t));
itonextspike = itonextspike(itonextspike > 2); % refractory period = 0.002 ms
ispikes = cumsum(itonextspike);
ispikes = ispikes(ispikes < (duration/delta_t));
nspikes = length(ispikes);
s = sparse(1,ispikes,1,1,idur,nspikes);
if (nargout == 0)
plot(t,s)
end
s = full(s);
Use the Inverse CDF formula for a Poisson random variable: F_x(x)=1e^{lambda x}
This can be rearranged to give:
x = ln(1F_x(x))/lambda
1 F_x(x) can be replaced by a Uniform random variable U(0,1).
So, to generate intervals and spike times for a Poisson input with a firing rate, lambda:
(MATLAB)
isi = log(rand(1,Nspikes))/lambda;
spikes = cumsum(isi);
(NEURON)
objref isi, rand,spikes
rand = new Rand()
rand.uniform(0,1)
isi = new Vector(Nspikes)
isi.setrand(rand).log().mul(lambda)
spikes = new Vector()
spikes.integral(isi)
This can be rearranged to give:
x = ln(1F_x(x))/lambda
1 F_x(x) can be replaced by a Uniform random variable U(0,1).
So, to generate intervals and spike times for a Poisson input with a firing rate, lambda:
(MATLAB)
isi = log(rand(1,Nspikes))/lambda;
spikes = cumsum(isi);
(NEURON)
objref isi, rand,spikes
rand = new Rand()
rand.uniform(0,1)
isi = new Vector(Nspikes)
isi.setrand(rand).log().mul(lambda)
spikes = new Vector()
spikes.integral(isi)

 Posts: 220
 Joined: Thu Jun 09, 2005 1:09 pm
 Location: Hanze University of Applied Sciences
 Contact:
The code above gives a spiketrain with the same statistical properties as that generated by a NetStim object with noise set to 1 and the interval to 1/lambda and number=Nspikes. NetStim is the easiest solution if you need the spiketrain in a network to randomly activate a synapse.meager wrote:(NEURON)
objref isi, rand,spikes
rand = new Rand()
rand.uniform(0,1)
isi = new Vector(Nspikes)
isi.setrand(rand).log().mul(lambda)
spikes = new Vector()
spikes.integral(isi)
Ted's remark
applies here.Ted wrote: When neuroscientists talk about Poisson distribution, they generally mean a 1 dimensional
Poisson process, which is to say, a series of events that happen at intervals that are
described by a negative exponential probability density.
Re: Poisson distributed synaptic input
A modified version of NetStim giving different orders of gamma distributions is available here:
http://senselab.med.yale.edu/simtooldb/ ... ool=116230
Joe
http://senselab.med.yale.edu/simtooldb/ ... ool=116230
Joe