Review of PROBABILITY DISTRIBUTIONS Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 1
Probability distribution Probability that a (continuous) random variable X is in (x,x+dx). ( ) P x < X < x + dx Probability density function (PDF). P( x < X < x + dx) f ( x) = lim dx +0 dx P( x < X < x + dx) f ( x)dx Cumulative distribution function (CDF) = Life time distribution. x F ( x) = P( X x) = f ( s)ds Survival function = Complementary CDF. ( ) = P( X > x) = f s F x x ( )ds =1 F ( x) 0.8 0.6 0.4 0.2 0 0 2 4 6 1 0.8 0.6 0.4 0.2 PDF X gamma distrib. CDF 0 0 2 4 6 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 2
The fundamental theorem of calculus The relation between probability distribution and probability density function. ( ) = f s F x x ( )ds d dx F x ( ) = d dx " #$ x f ( % s)ds &' = f x ( ) Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 3
Probability distribution: Example Exponential distribution Probability density function (PDF). Cumulative distribution function (CDF). f ( x) = λe λx F ( x) = P( X x) =1 e λx Survival function. 1.0 F ( x) = P( X > x) =1 F ( x) = e λx 0.8 0.6 0.4 0.2 1 2 3 4 5 Expectation E! " X # $ = λ 1 Variance var! " X # $ = λ 2 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 4
Samples from a distribution 0.8 PDF If a random variable X follows a cdf FX, then the r.v. U given by U = F X X ( X ) = f X ( s)ds follows an uniform distribution in [0,1]. U 0.6 0.4 0.2 1 0.8 0.6 X gamma distrib. 0 0 2 4 6 CDF f X F X ( x) ( x) 0.4 0.2 0 0 2 4 6 X Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 5
Homework 1-1 Problem Confirm that U = F X ( X ) follows an uniform distribution in [0,1]. x when X is a random variable from F X ( x) = f X ( s)ds 0 Hint Suppose a random variable (r.v.) X given by a pdf Consider a r.v. Y that is transformed from X using a monotonic function g. Y = g X The distribution of Y is given as f Y f X ( ) ( y) = f X ( x) dx dy = f X ( x) ( x ) g! ( x) 1 x Consider a particular relation given by CDF, g ( x) = F X ( x) = f X s Then we obtain f Y ( y) = f X ( x) g! ( x) 1 = f X ( x) f X ( x) 1 =1 ( )ds Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 6
Samples from a distribution Inverse function method 1 CDF Let U be an uniform r.v.. X X that satisfies U = f X ( s)ds The r.v. X = F 1 ( U ) follows the density f X follows the CDF given by F. ( x). 0.8 0.6 0.4 0.2 0 0 2 4 6 Exponential distribution: U = F X f X X = F X 1 U ( x) = λe λx X ( X ) = λe λs ds =1 e λ X A r.v. that follows an exponential distribution with rate λ is generated using an uniform r.v. X as ( ) = λ 1 log( U ) Memo: The distribution that can be inverted analytically is limited, e.g., Exp., Weibull, Pareto, etc. For other distributions, one can numerically compute CDF to obtain X. Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 7
Introduction to POISSON POINT PROCESS Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 8
Memoryless process A point process is memoryless if intervals X satisfy ( ) = P( X > s) P X > s + t X > t Question. Suppose that you bought a refrigerator t years ago. It still works well. How long will it continue to work from now? 0 t s t + s X Event Answer. We wish to know the probability that the refrigerator survives another s years given that it survived t years. This is given as P( X > s + t X > t). From the memoryless property, it is equivalent to P( X > s). Thus, the fact that the refrigerator survived t years did not provide any information to predict a failure of the refrigerator in future. Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 9
Exponential distribution Q. What distribution possesses the memoryless property? Ans. The exponential distribution: f ( x) = λe λx The survival function can be written in a conditional form as Using the memoryless property, we obtain ( ) = P( X > s) P( X > t) P X > s + t The exponential distribution satisfies the memoryless property. If ( ) = e λx P X > x Density is given as ( ) = P( X > s + t X > t) P( X > t) P X > s + t, then P X > s ( ) P( X > t) = e λs e λt f ( x) = d dx P ( X > x ) = λe λx ( ) = e λ (s+t ) = P X > s + t
Poisson point process If intervals of events are samples from the exponential distribution, and the intervals are independent each other, then the process is memoryless. This process is called a (homogeneous) Poisson point process. Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 11
Simulating a Poisson process Question. How can we simulate a Poisson point process? Ans. Use the inverse function method to generate an inter-spike interval (ISIs) that follows an exponential distribution. 1.0 0.8 0.6 ISI X = λ 1 logu 0.4 0.2 1 2 3 4 5 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 12
The Poisson distribution Let s consider a distribution of the number of spikes that occurred in T[s]. N T : the number of spikes that happens in T [s] 1 2 3 N T -th spike T A count distribution of a Poisson point process is given by a Poisson distribution. Ê Ê 0.35 0.30 ( ( ) = λt ) n P N T = n n! e λt 0.25 0.20 0.15 Ê Ï Ï Ï Ï 0.10 Ï Ï Ï Ê Ï 0.05 Ê Ï Ï Ï Ï Ï Ï Ï Ï Ï Ê Ê Ï Ê Ê Ê Ê Ê Ê Ê Ê Ê Ê Ê Ï Ê ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ ÏÊ 5 10 15 20 25 30 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 13
Homework 1-2 Problem Derive the Poisson distribution for the first few spike counts, N T = 0,1,2. Hint N T = 0 X 1 T If there is no spike in T, then the first spike occurred after T. This is given by survival function of an exponential distribution. P( N T = 0) = P( X 1 > T ) = F ( T ) N T =1 X 2 Let the first spike occurred at s_1, the first ISI follows an exponential density, the second ISI should be greater than T-s_1. s 1 T T ( ) = f ( s 1 ) F T s 1 P N T =1 0 ( )ds 1 N T = 2 X 3 Similarly if you have two spikes in T, s 1 s 2 T T T ( ) = f ( s 1 ) f ( s 2 s 1 ) F T s 2 P N T = 2 0 s 1 ( )ds 1 ds 2 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 14
The Erlang distribution Let s consider a distribution of a waiting time τ until spikes occurred n times. 1 2 3 n-th spike τ Waiting time of multiple spikes from a Poisson process is given by an Erlang distribution. 0.4 ( ) = λ n τ n 1 P τ < X < τ + dτ ( n 1)! e λτ dτ 0.3 0.2 0.1 2 4 6 8 10 12 14 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 15
Spike count and ISI The relation between a Poisson and Erlang distribution. 1 2 3 n-1 n N τ spikes τ S n If S n > τ, the number of spikes in is at most n-1. P( N τ < n) = P( S n > τ ) Rhs is a survival function of an Erlang distribution. ( ) = λ n t n 1 e λt dt P S n > τ = τ n 1 k=0 ( λτ ) k k! Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 16 e λτ ( ) n P( N τ = n) = P( N τ < n +1) P( N τ < n) = λτ n! e λτ
Instantaneous spike rate Alternative definition of a Poisson point process Divide T into small N bins of a small width Δ (T=NΔ). Spike t Δ t + Δ P( a spike in [t,t + Δ) ) = λδ + o( Δ) P ( >1 spikes in [t,t + Δ) ) = o( Δ) Instantaneous spike rate P( no spikes in [t,t + Δ) ) =1 λδ + o( Δ) o( Δ) is a function that approaches to zero faster than Δ : ( ) o Δ lim Δ +0 Δ = 0 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 17
Relation to the Poisson distribution The probability of a spike/no spike is an approximation of the Poisson distribution for a small time bin. The spike count in a small bin is approximated as In particular, ( ( ) = λδ ) n P N Δ = n P N Δ = 0 # n! ( ) n e λδ = λδ n! ( ) =1% 1 λδ + 1 ( 2 λδ ) 2 + P N Δ =1 $ # ( ) = λδ% 1 λδ + 1 ( 2 λδ ) 2 + $ P( N Δ = 2) = ( λδ) 2 % 1 λδ + 1 2 λδ # $ # % 1 λδ + 1 $ 2 λδ ( ) 2 + & ( =1 λδ + o Δ ' & ( = λδ + o( Δ) ' & ( = o( Δ) ' ( ) 2 + ( ) & ( ' Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 18
Exponential / Poisson distribution revisited The exponential distribution from an instantaneous spike rate. The probability that no spikes happened in N-1 bins and a spike happened in the last bin (geometric distribution). (x=nδ) P( x < X < x + Δ) = ( 1 λδ) N 1 λδ + o( Δ) ISI distribution: f ( x) = lim ( ) P x < X < x + Δ Δ 0 Δ = λe λx The Poisson distribution from an instantaneous spike rate. The probability that n spikes happened in N bins (T=NΔ). P( N T = n) =! # " N n ( ( ) N n ( λδ) n λt ) n $ & 1 λδ % n! e λt as Δ 0 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 19
Exponential distribution revisited We can derive the exponential distribution from an instantaneous spike rate, λ [spike/sec] Divide T into small N bins of a width Δ. Δ T = NΔ N bins Spike Probability a spike in a bin: λδ >2 spikes in a bin: o( Δ) no spikes in a bin: 1 λδ + o( Δ) The probability that no spikes happened in N-1 bins and a spike happened in the last bin. P( x < T < x + Δ) = ( 1 λδ) N 1 λδ + o( Δ) ISI distribution: P( x < T < x + Δ) f ( x) = lim Δ 0 Δ = λe λx Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 20
Poisson distribution revisted We can derive the Poisson distribution from an instantaneous spike rate, λ [spike/sec] Divide T into small N bins of a width Δ. N bins Δ Spike T = NΔ Probability a spike in a bin: λδ >2 spikes in a bin: o( Δ) no spikes in a bin: 1 λδ + o( Δ) The probability that n spikes happened in T [s]. P( N T = n) =! # " N n ( ( ) N n ( λδ) n λt ) n $ & 1 λδ % n! e λt as Δ 0 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 21
Homework 1-3 Problem The probability that no spikes happened in N-1 bins and a spike happened in the last bin is given as P( x < X < x + Δ) = ( 1 λδ) N 1 λδ + o( Δ) = λδ ( 1 λδ) N + o( Δ) 1 λδ Show that the ISI distribution becomes an exponential distribution. Hint Approximate the terms by the Taylor expansions. 1 1 x =1+ x + x2 + x 3 λδ 1 λδ Hence we obtain = λδ{ 1+ λδ + ( λδ) 2 + } = λδ + o( Δ) ( ) = x 1 2 x2 1 3 x3 log 1 x P( x < X < x + Δ) = λδexp[ λx] + o( Δ), and f ( x) = lim ( 1 λδ) N = exp#$ N log( 1 λδ) % & # ' = exp-n ( λδ 1 $ ) 2 λδ / = e λx 1 1 2 λ 2 1 2 xδ + 4 0 3 ( ) 2 Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 22 Δ 0 P( x < X < x + Δ) Δ *% +.,& = λe λx
Problem Homework 1-4 Probability that n spikes occur in N bins (T [s]) is given as! N $ P( N T = n) = # &( λδ) n ( 1 λδ) N n " n % Show that the probability becomes the Poisson distribution for large N and small Δ with a relation given by a constant T=NΔ. Hint Using an approximation given by the Taylor expansions (See previous slides). n N! # λδ & P( N T = n) = % ( ( 1 λδ) N N! ( ( N n)!n! $ 1 λδ ' ( N n)!n! λδ ) n exp[ λδn] Use the relation, T=NΔ, to obtain P( N T = n) = Use the Stirling s formula and prove that N! 1 ( ( N n)!n n n! λt ) n exp[ λt ] ln N! ~ N ln N N N! ln ( N n)!n = " 1 n % $ n # N & 'ln " 1 n % $ # N ' & Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 23 N n =1 lne n n 0
Likelihood function Likelihood function t 1 t 2 t n 0 T p( t 1,t 2,,t n N T = n) = λ n exp[ λt ] Proof p( t 1,t 2,,t n N T = n)δ n n = f ( t 1 )Δ f ( t i t i 1 )Δ i=2 n P( t n+1 > T t n ) = λ exp( λt 1 )Δ λ exp&' λ t i t i 1 [ ] = λ n Δexp λt i=2 Here the ISI distribution is ( ) ( ) Δ exp&' λ ( T t n )( ) f ( x) = λ exp[ λx] Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 24
INHOMOGENEOUS POISSON PROCESS Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 25
Inhomogeneous Poisson process Instantaneous rate λ ( t) Point process t t +Δ P( a spike in [t,t + Δ) ) = λ ( t)δ + o( Δ) Time-dependent rate Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 26
Inhomogeneous Poisson process Instantaneous rate λ ( t) Point process t i 1 t i f ( t t i 1 ) = λ t # ( )exp t λ ( u & $% )du t i 1 '( for t > t i 1 Note that the above formula extends the exponential ISI of homogeneous Poisson process. Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 27
Homework 1-5 Problem Derive the ISI density of the inhomogeneous Poisson process. Hint Let the last spike occurred at time 0. The probability of a spike occurrence in [t, t+δ) is given as ( ) = 1 λ kδ P t < X < t + Δ N 1 k=1 #$ ( )Δ% & #$ λ ( NΔ)Δ% & + o( Δ) = λ ( NΔ N )Δ #$ 1 λ ( kδ)δ% & + o( Δ) 1 λ ( NΔ)Δ k=1 Using the following approximation, N #$ 1 λ ( kδ)δ % # N % # N % & = exp) log{ 1 λ ( kδ)δ} * = exp) { λ ( kδ)δ + o( Δ) }* k=1 $ k=1 & $ k=1 & λ ( NΔ)Δ 1 λ ( NΔ)Δ = λ ( NΔ )Δ + o( Δ) P( t < X < t + Δ) f ( t) = lim = λ t % t Δ 0 ( )exp λ ( u ( The ISI density is given as )du 0 Δ &' )* Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 28
Likelihood function Likelihood function λ ( t) ( ) = λ ( t i ) p t 1,t 2,,t n N T = n 0 T t 1 t 2 n exp % T λ ( u ( &' )du 0 )* i=1 t n Proof p( t 1,t 2,,t n N T = n)δ n = f ( t 1 )Δ f ( t i t i 1 )Δ n n i=2 = λ ( t i )Δexp ' T λ ( u * () )du 0 +, i=1 P( t n+1 > T t n ) Here the ISI distribution is given as f ( t i t i 1 ) = λ t i # t i ( )exp λ ( u & $% )du t i 1 '( Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 29
What we learned 1 2 3 4 5 6 Memoryless property of a process. Exponential distribution = Poisson process. Poisson count distribution, Waiting time distribution (Erlang). Definition of a Poisson process using instantaneous firing rate. Exponential and a Poisson count distribution revisited. Inhomogeneous Poisson process: ISI distribution and likelihood Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 30
Tomorrow, we will learn 1 2 Renewal process: Conditional intensity function and ISI density. non-poisson process (Point process written by the conditional intensity function) 3 Time-rescaling theorem 4 5 How to simulate a point process via the time-rescaling theorem. How to assess a point process model via the time-rescaling theorem. (Q-Q plot and K-S test) Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 31
Follow-up from the lecture feedback Stimulus signal x( t) Tomorrow s topic. Instantaneous spike-rate λ ( t) Today s topic. Point process t t +Δ P( a spike in [t,t + Δ) ) = λ ( t)δ + o( Δ) Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 32
Likelihood function Density function An observed sample Likelihood function f ( x) = λe λx X L( λ) = f ( X) = λe λx Multiple observation X 1, X 2,, X n Likelihood function ( ) = p( X i λ) L λ n i=1 Maximum likelihood estimation (MLE) λ MLE = argmax λ n i=1 ( ) p X i λ Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 33
Likelihood of a Poisson process Likelihood function of a homogeneous Poisson process ( ) = p( t 1,t 2 t 1,,t n t n 1 N T = n) p t 1,t 2,,t n N T = n λ f ( t i t i 1 ) = λe λ ( t i t i 1 ) Inter-spike Intervals (ISIs) n = f ( t i t i 1 ;λ) F T t n ;λ i=1 [ ] = λ n exp λt ( ) Likelihood function of a inhomogeneous Poisson process p( t 1,t 2,,t n N T = n λ 0:T ) = p( t 1,t 2 t 1,,t n t n 1 N T = n) f ( t i t i 1 ) = λ t i # t i ( )exp λ ( u & $% )du t i 1 '( n ( ) = f t i t i 1 ;λ ti :t i 1 F T t i ;λ tn :T i=1 n = λ ( t i ) exp & T λ ( u ) '( )du 0 *+ i=1 ( ) Hideaki Shimazaki, Ph.D. http://goo.gl/visng Poisson process 34