=====================================================
Markov-modulated Poisson process code for Matlab
=====================================================
This zip file contains code for MCMC inference on a Markov modulated 
Poisson process for event detection, as described in 
  "Adaptive Event Detection with Time-Varying Poisson Processes"
    Ihler, Hutchins, Smyth; Proceedings, Knoweldge Discovery and Data 
    Mining, 2006.
It also contains 10 weeks of count data from a UCI campus building.

The data should be TxN, where T is the number of time-slices per day (48
for half-hour intervals) and N is the number of days, which should be a
multiple of 7.  Counts are non-negative, with "-1" representing missing
observations.
    
The code relies on the Matlab Statistics Toolbox for the following 
sampling functions: betarnd, gamrnd, poissrnd, nbinrnd.
If you do not have the Matlab Statistics Toolbox, equivalent functions
can be obtained from the "KPMStats" collection of functions by Kevin Murphy.

You are welcome to use both the code and data for research and other
non-commercial purposes, in accordance with the GPL (see below).
Publications making use of the code or data should cite the previously
referenced publication.
    


=====================================================
USAGE EXAMPLES
=====================================================

load data.mat		% load the door entry/exit data

% run MMPP model on exit data with no parameter sharing
samples1 = mmpp(Nout,priors,[50,10,20],event_times,[3,3]);

% run MMPP model on exit data with shared weekend/weekday time profiles
samples2 = mmpp(Nout,priors,[50,10,20],event_times,[3,2]);

% run MMPP model on exit data with shared weekend/weekday average rates
samples3 = mmpp(Nout,priors,[50,10,20],event_times,[2,3]);

%
% You should see "." appear at each iteration (comment this out in the code 
%  if desired), and an estimate of the marginal likelihood of the data after
%  every Nplot iterations (in the above examples, 20).
%


=====================================================
COPYRIGHT / LICENSE
=====================================================
The MMPP Matlab code package was written by Alex Ihler and Jon Hutchins,
and are copyrighted under the (lesser) GPL:
  Copyright (C) 2006  Alexander Ihler

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; version 2.1 or later.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

The authors may be contacted via email at: ihler@alum.mit.edu


