No BSD License  

Highlights from
Simulate a Hawkes process

image thumbnail
from Simulate a Hawkes process by Dimitri Shvorob
(and visualize it)

showhawkesm(m,t,H,par)
function showhawkesm(m,t,H,par)
% SHOWHAWKESM Plot intensities and event times of a Hawkes process
%             (Constant-unconditional-intensity first-order exponential-
%             decay M-variate Hawkes process; selected component series)
% Inputs      m   - indexes of selected component series, k*1 vector
%             t   - end time (Zero starting time assumed)
%             H   - process history, M*1 cell array; vector H{n} stores 
%                   event-occurrence times for component series n
%             par - process-parameters structure containing fields
%                   'mu'    - M*1 vector (unconditional intensities)
%                   'alpha' - M*M matrix (multiply the exponent terms)
%                   'beta'  - M*M matrix (degrees of the exponents)
% Example     See HAWKESDEMO
% Author      Dimitri Shvorob, dimitri.shvorob@vanderbilt.edu, 12/12/07
x = linspace(0,t,100);
k = length(m);
figure, set(gcf,'Color','w')
for i = 1:k
    subplot(k,1,i)
    n = m(i);
    h = H{n}; 
    l = inthawkesm(n,x,H,par);
    y = 0.05*max(l);
    e = length(h);
    for j = 1:e
        line([h(j) h(j)],[0 y],'Color','k','LineWidth',2), hold on
    end    
    plot(x,l,'Color',[.8 0 0],'LineWidth',2)
    axis([0 t 0 1.1*max(l)])
    title (['Series ' num2str(n)])
    ylabel(['Intensity, \it\lambda_{' num2str(n) '}'])
    xlabel(['Event-occurrence time (' num2str(e) ' events total)'])
end

Contact us at files@mathworks.com