org.omegahat.Simulation.MCMC.Examples
Class SimpleMetropolisHastingsSampler

java.lang.Object
  |
  +--org.omegahat.Simulation.MCMC.NotifyingMCMCObject
        |
        +--org.omegahat.Simulation.MCMC.BaseMarkovChain
              |
              +--org.omegahat.Simulation.MCMC.Examples.SimpleMetropolisHastingsSampler
All Implemented Interfaces:
MarkovChain, NotifyingObject, java.lang.Runnable

public class SimpleMetropolisHastingsSampler
extends BaseMarkovChain

A simple Markov Chain example. It simply generates its next state from N(0,1) regardless of the current state.


Inner Class Summary
protected  class SimpleMetropolisHastingsSampler.BivariateDoubleState
           
static class SimpleMetropolisHastingsSampler.listenerPrinter
           
 
Inner classes inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
NotifyingMCMCObject.MyHandle
 
Field Summary
protected  double delta
           
protected  Normal norm
           
protected  PRNG prng
           
protected  double rho
           
protected  double sigma
           
protected  SimpleMetropolisHastingsSampler.BivariateDoubleState state
           
 
Fields inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
listeners
 
Constructor Summary
SimpleMetropolisHastingsSampler(PRNG prng, double sigma, double rho, double delta)
           
 
Method Summary
protected  double acceptanceProb(double[] current, double[] proposed)
           
protected  double bivariateDensity(double[] bvstate)
           
 MCMCState generate(MCMCState state)
          Generate the next state from the current one
static void main(java.lang.String[] argv)
           
protected  double square(double x)
           
protected  double transitionDensity(double[] from, double[] to)
           
 
Methods inherited from class org.omegahat.Simulation.MCMC.BaseMarkovChain
getState, iterate, run, step
 
Methods inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
notifyAll, registerListener, unregisterListener
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sigma

protected double sigma

rho

protected double rho

delta

protected double delta

prng

protected PRNG prng

norm

protected Normal norm

state

protected SimpleMetropolisHastingsSampler.BivariateDoubleState state
Constructor Detail

SimpleMetropolisHastingsSampler

public SimpleMetropolisHastingsSampler(PRNG prng,
                                       double sigma,
                                       double rho,
                                       double delta)
Method Detail

square

protected double square(double x)

bivariateDensity

protected double bivariateDensity(double[] bvstate)

transitionDensity

protected double transitionDensity(double[] from,
                                   double[] to)

acceptanceProb

protected double acceptanceProb(double[] current,
                                double[] proposed)

generate

public MCMCState generate(MCMCState state)
Description copied from class: BaseMarkovChain
Generate the next state from the current one
Overrides:
generate in class BaseMarkovChain

main

public static void main(java.lang.String[] argv)