NAME

Math::StochasticProcess - Stochastic Process

VERSION

Version 0.04

SYNOPSIS

use Math::StochasticProcess;

my $analysis = Math::StochasticProcess->new(seed_event=>It_all_started_here=>new,
                                        tolerance=>0.0001);
$analysis->run();
print $analysis->event("Dont_worry_It_might_never_happen")->probability();
...

DESCRIPTION

One defines a stochastic process by inheriting from the Math::StochasticProcess::Event class and implementing the virtual functions. The process can be run until all events have become resolved (or else have probabilities that have dipped below a tolerance parameter).

As an added convenience one may use the Math::StochasticProcess::Event::Tuple class which derives from the Event class. This represents a tuple of random variables. This defines all undefined base functions, apart from "iterate" which actually defines what how an Event moves to the next iteration.

For theoretical background, see wikipedia articles: http://en.wikipedia.org/wiki/Stochastic_matrix and http://en.wikipedia.org/wiki/Stochastic_processes.

FUNCTIONS

new

This is a standard constructor function. The arguments are as follows:

seed_event

This mandatory argument must be an instance of the Math::StochasticProcess::Event class and its probability must be 1.

tolerance

This defaults to 0.00001. It specifies the probability below which we just throw events away.

soft_sanity_level

If specified this determines how far we allow the sum of all probabilities to diverge from 1, before warning.

hard_sanity_level

If specified this determines how far we allow the sum of all probabilities to diverge from 1, before dieing.

log_file_handle

If specified this should be a FileHandle object to which we write our debug statements.

run

This is the core function of the whole package. It iterates from the seed event until no unresolved events remain. Once it completes the object can be queried for the results.

event

This returns the result of the run. With no additional parameters it runs a list of signatures and events which can be put in a hash. Otherwise it takes as a single non-object parameter a signature and returns the corresponding event.

expectedValue

This is another function returning the result of the run. With no additional parameters it runs a list of random variable names and their expected terminal values. This list can be put into a hash. Otherwise it takes as a single non-object parameter a random variable name and returns the corresponding expected value.

_calculateExpectedValue

Internal function. Used by expectedValue.

_numUnresolved

The number of unresolved events.

_sanityCheck

Ideally should always be zero, but must at least be close.

_iterate

Internal function. Essentially one round in the "run" function.

_merge

Internal function. Called inside "run" function when in case two events are essentially the same.

AUTHOR

Nicholas Bamber, <theabbot at silasthemonk.org.uk>

BUGS

Please report any bugs or feature requests to bug-math-stochasticprocess at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-StochasticProcess. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Math::StochasticProcess

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2008 Nicholas Bamber, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.