org.omegahat.Simulation.MCMC.Examples
Class SimpleMetropolisSampler

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

public class SimpleMetropolisSampler
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 SimpleMetropolisSampler.BivariateDoubleState
           
static class SimpleMetropolisSampler.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  SimpleMetropolisSampler.BivariateDoubleState state
           
 
Fields inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
listeners
 
Constructor Summary
SimpleMetropolisSampler(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)
           
 
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 SimpleMetropolisSampler.BivariateDoubleState state
Constructor Detail

SimpleMetropolisSampler

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

square

protected double square(double x)

bivariateDensity

protected double bivariateDensity(double[] bvstate)

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)