dna model -> Statistics m34 galaxy -> Research 2xfj protein -> Links protein gel -> Personal Park Street, Bristol SuSTaIn UoB
Mathematics home Statistics home Postgrad opportunities Statistics clinicPeter Green Research Papers Collaborators Software Books Links Personal Statistical Science Editorial policy Future papers Instructions for authors SuSTaIn ACEMS Past Earth Network Royal Statistical Society International Society for Bayesian Analysis Royal Society

PJG Home / Software

Cpt

-- a program for Bayesian multiple change point analysis for point processes, implementing the approach of
Green, P. J. (1995) Reversible jump Markov chain Monte Carlo computation and Bayesian model determination, Biometrika, 82, 711-732.
If you download the files, please send a message to me at my email address, with your email address and any comments. I can then keep you informed of any updates.

Instructions (also included among the downloaded files)
This is a brief description of how to use the Fortran program cpt,
that implements the multiple change-point analysis for point
processes described in
Green, P. J. (1995) Reversible jump Markov chain Monte Carlo
computation and Bayesian model determination, Biometrika, 82,
711732.

The code and some auxiliary files, including the coal disaster 
data set, are all in the accompanying .zip file
The files are:
cpt.f             (main program)
dummy_ieee_chk.f  )
rgamma.f          ) auxiliary
sd.c              ) routines
algama.f          )
Makefile          (instruction file for make)
coal.dat          (data)
info.txt          (this file)

It is designed for a unix-like programming environment, and in
particular the commands in Makefile assume GNU compilers gcc and
g77. Such details are easily changed for other unix-like systems.

The progam takes a single input data file (with extension .dat)
together with control parameters specified on the command line
invoking the program, in unix style. These parameters include
      -nN         MCMC run length (default 10000)
      -nbN        length of burnin (default #sweeps/10)
      -nsN        sampling interval for selected parameters 
                  (default #sweeps/1000)
      -aN         set value for alpha, default 1.0 (a zero value 
                  gives alpha a Gamma(c,d) hyperprior, with c and 
                  d set by -c and -d options below
      -bN         set value for beta, default L/n (a zero value 
                  gives beta a Gamma(e,f) hyperprior, with e and 
                  f set by -e and -f options below
      -cN         )              - default 2.0
      -dN         ) see -aN and  - default 2.0
      -eN         ) -bN above    - default 1.0
      -fN         )              - default n/L
      -lN         lambda
      -seedN      (integer) random number seed (0 implies use 
                  clock time)
      -kiN        initial value for k (number of steps)
      -fix        suppress dimension-jumping moves
where N is a suitable numerical value for each parameter, and n is
the number of data points and L the length of the observation
interval. There should be one further parameter - the data file
name (without the .dat extension).

The program's output goes into (up to) 7 files in a directory with
the same name as the data file (without the .dat extension). Each
filename is prefixed by M. where M is the run number (sequentially
up through 1, 2, ...).
These files are:
M.log       record of parameters and MCMC performance
M.av        posterior mean of x(t) on an equi-spaced grid of 
            t values
M.pos       samples of step positions
M.ht        samples of step heights
M.k         samples of numbers of steps
M.alpha     samples of alpha (only written if alpha is variable)
M.beta      samples of beta (only written if beta is variable)
(The last 5 are based on thinning the whole run on
the basis of the -ns parameter.)

Example of compilation and run

~/Research/cpt $ make

g77   -c -o cpt.o cpt.f
g77   -c -o algama.o algama.f
g77   -c -o rgamma.o rgamma.f
gcc -c sd.c -DSUNF -DRETS
g77   -c -o dummy_ieee_chk.o dummy_ieee_chk.f
g77 -o cpt.exe cpt.o algama.o rgamma.o sd.o dummy_ieee_chk.o

~/Research/cpt $ mkdir coal

~/Research/cpt $ cpt -n200000 coal -a0

 coal/1: c:\home\Research\cpt\cpt.exe -n200000 coal -a0
 random number seed: 1071764783

alpha     Gamma:    2.00    2.00
beta    214.1728
lambda    3.0000
seed    1071764783
nsweep      200000
nburnin      20000

         acc    try
death  17413  87990
birth  17414  78605
ht    103153 200000
pos    40584 200000
alpha 160195 200000

total acceptances 338759

mean k        3.1588
mean alpha    1.0742

~/Research/cpt $ ls coal

1.alpha   1.av   1.ht   1.k   1.log   1.pos 

Cpt is free of charge for educational and non-commercial research purposes.

Please report any problems with the code to the author, Peter Green, via Email link

Professor Peter Green, School of Mathematics, University of Bristol, Bristol, BS8 1TW, UK.
Email link Telephone: +44 (0)117 928 7967; Fax: +44 (0)117 928 7999
Peter in Chinese characters email as QR barcode