
ABOUT OUTBREAKSIM CODE
----------------------
Code written on the 20/10/2006 by
R Watkins, S Eagleson, S Beckett, G Garner.

This code is written in MapBasic and runs using MapInfo Professional.
This code can be freely distributed and altered. 
Acknowledgement of the original source is appreciated.
No warranty is provided and no liability is accepted for the use of this code.

There are 4 main code files: 
1. sim file - the main structure of the program and startup processes
2. infect file - spreads infection and progresses cases through disease states
3. output file - creates output files
4. library file - definitions file

These files are compiled into the executable file project.mbx.
All code (.mb) files can be viewed and edited in any text editor.

For the existing file paths to work the folder 'OutbreakSim' should be placed 
within the MapInfo folder: "C:\Program Files\MapInfo\OutbreakSim". 

The linegraph file provides a template for the graphical output.
The blank file provides a background for the simulation progresss window.


OutbreakSim version 1.0 information
-----------------------------------
The data files provided with this code are for demonstration purposes only.
The map areas file includes 32 postal areas from the south-west of Western Australia.
The addresspoints file includes simulated data only as an indicator of population density. 
The sample baseine data (100 days - aditional days can be added) is simulated data only.


Useage notes
------------

Running the program:
- the program can be run by double clicking on the file OBsim_project.MBX in the program 
  files directory. This file can also be selected through the MapInfo Tools menu under 
  'Run MapBasic Program'. 

Run time:
- the time required to run a simulation depends on the population size and the 
  number of infections occurring, as well as the computing resources available.
- it is recommended that short duration simulations are run initially to 
  allow estimation of the required running time.

Parameters:
- Model parameters can be edited when running the model in the provided editable fields 
  within the maion startup dialog as well as the edit parameters dialog. The parametersM
  table includes the default parameters for the parameters dialog, and these default 
  values can also be edited directly using MapInfo. 

Probability of report:
- applies to all simulated cases only (endemic or outbreak) and does not
  apply to endemic cases from file

Person-person endemic:
- the first simulated person-person endemic case is inserted on day 1 as infectious.
- parameters must be chosen carefully to avoid endemic cases increasing during longer 
  simulations.

Poisson Endemic:
- the first poisson endemic case is inserted when the random poison sampler exceeds zero.
- the number of exposed cases reported when using the poisson endemic function
  will be equal to the number of poisson-endemic cases, as the person-person 
  spread function is not used. 
- poisson endemic cases are always inserted into the dataset in randomly chose locations.

Endemic data from file:
- Historical baseline data can be included in the simulation by loading these data into 
  the BaselineM table which is in the parameter files directory. For the current proram 
  settings, these data need to be in the counts per postcode per day format. Example 
  data are provided.  

Output files:
- Output files are generated in .DBF format in the analysis folder for input into data 
  analysis programs. 
- If only simulated data are output, the simulation results (counts by postcode by day) 
  will be contained in the pc_counts file. 
- If historical endemic data are used, the outbreak simulation results only will be 
  contained in the pc_counts file, and the sum of the baseline and outbreak cases will 
  be saved in the SumEOB file. 
- A .DBF file named Settings is also generated to document the parameters used in the simulation.

Beta-pert distribution:
- The beta-pert distribution used is limited by the inability to calculate factorials
  of numbers greater than 170. Thus, overflow errors may occur if very extreme beta-pert
  distribution parameters are specified.
 
Triangle distribution: 
- If this distribution is used (it isn't currently called) the minimum must not equal the 
  maximum value (ie. there must be a positive range). 
