org.omegahat.Simulation.MCMC
Class CustomHastingsCoupledSampler

java.lang.Object
  |
  +--org.omegahat.Simulation.MCMC.NotifyingMCMCObject
        |
        +--org.omegahat.Simulation.MCMC.BaseMarkovChain
              |
              +--org.omegahat.Simulation.MCMC.CustomMarkovChain
                    |
                    +--org.omegahat.Simulation.MCMC.CustomHastingsCoupledSampler
All Implemented Interfaces:
HastingsCoupledSampler, MarkovChain, NotifyingObject, java.lang.Runnable
Direct Known Subclasses:
BoundedHastingsCoupledSampler

public class CustomHastingsCoupledSampler
extends CustomMarkovChain
implements HastingsCoupledSampler

A Hastings Coupled Sampler that consistes of $C$ component samplers. The target distribution of the $C$ components is created by the product of $C$ independent copies of the target state. At each time step, only one component is updated. A separate proposal distribution can be used for each component. These proposal distributions can be either GeneralProposals, or HastingsCoupledProposals. The latter propose the new state for one sampler based on the current state of all samplers.


Inner classes inherited from class org.omegahat.Simulation.MCMC.CustomMarkovChain
CustomMarkovChain.listenerPrinter, CustomMarkovChain.NormalGenerator
 
Inner classes inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
NotifyingMCMCObject.MyHandle
 
Field Summary
protected  boolean accepted
           
 boolean DEBUG
           
protected  boolean detailed
           
protected  int index
           
protected  double log_p_X
           
protected  double log_p_Y
           
protected  double log_q_X_to_Y
           
protected  double log_q_Y_to_X
           
protected  double logAcceptProb
           
protected  int numAccepted
           
protected  int numProposed
           
protected  int numSamplers
           
protected  int[] order
          Random Number Generator
protected  PRNG prng
          the current state
protected  HastingsCoupledProposal proposal
           
protected  MultiState state
          target distribution
protected  UnnormalizedDensity target
          proposal method
protected  double uniformRand
           
 
Fields inherited from class org.omegahat.Simulation.MCMC.CustomMarkovChain
generator
 
Fields inherited from class org.omegahat.Simulation.MCMC.NotifyingMCMCObject
listeners
 
Constructor Summary
CustomHastingsCoupledSampler(MultiState state, int numSamplers, UnnormalizedDensity target, HastingsCoupledProposal proposal, PRNG prng)
           
CustomHastingsCoupledSampler(MultiState state, int numSamplers, UnnormalizedDensity target, HastingsCoupledProposal proposal, PRNG prng, boolean detailed)
           
 
Method Summary
protected  double acceptanceProb(java.lang.Object current, MultiState currentStateVector, java.lang.Object proposed, MultiState proposedStateVector, int which)
           
 MCMCState generate(MultiState currentStateVector)
           
 int getNumAccepted()
           
 int getNumProposed()
           
 int getNumSamplers()
           
 HastingsCoupledProposal getProposal()
           
 MCMCState getState()
          Get the current state of the Markov Chain.
 UnnormalizedDensity getTarget()
           
(package private)  void initialize()
           
 void iterate(int howmany)
          Perform several steps.
protected  double logAcceptanceProb(java.lang.Object current, MultiState currentStateVector, java.lang.Object proposed, MultiState proposedStateVector, int which)
           
(package private)  void permute()
           
 int resetNumAccepted()
           
 int resetNumProposed()
           
 int setNumSamplers(int numSamplers)
           
 HastingsCoupledProposal setProposal(HastingsCoupledProposal proposal)
           
 MCMCState setState(MultiState state)
           
 UnnormalizedDensity setTarget(UnnormalizedDensity target)
           
 void step()
          Generate the next state from the current state.
 
Methods inherited from class org.omegahat.Simulation.MCMC.CustomMarkovChain
generate, main
 
Methods inherited from class org.omegahat.Simulation.MCMC.BaseMarkovChain
run
 
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

proposal

protected HastingsCoupledProposal proposal

target

protected UnnormalizedDensity target
proposal method

state

protected MultiState state
target distribution

prng

protected PRNG prng
the current state

order

protected int[] order
Random Number Generator

index

protected int index

numSamplers

protected int numSamplers

numProposed

protected int numProposed

numAccepted

protected int numAccepted

logAcceptProb

protected double logAcceptProb

uniformRand

protected double uniformRand

accepted

protected boolean accepted

log_p_X

protected double log_p_X

log_q_X_to_Y

protected double log_q_X_to_Y

log_p_Y

protected double log_p_Y

log_q_Y_to_X

protected double log_q_Y_to_X

detailed

protected boolean detailed

DEBUG

public boolean DEBUG
Constructor Detail

CustomHastingsCoupledSampler

public CustomHastingsCoupledSampler(MultiState state,
                                    int numSamplers,
                                    UnnormalizedDensity target,
                                    HastingsCoupledProposal proposal,
                                    PRNG prng,
                                    boolean detailed)

CustomHastingsCoupledSampler

public CustomHastingsCoupledSampler(MultiState state,
                                    int numSamplers,
                                    UnnormalizedDensity target,
                                    HastingsCoupledProposal proposal,
                                    PRNG prng)
Method Detail

getProposal

public HastingsCoupledProposal getProposal()

setProposal

public HastingsCoupledProposal setProposal(HastingsCoupledProposal proposal)

getTarget

public UnnormalizedDensity getTarget()

setTarget

public UnnormalizedDensity setTarget(UnnormalizedDensity target)

getState

public MCMCState getState()
Description copied from interface: MarkovChain
Get the current state of the Markov Chain.
Specified by:
getState in interface MarkovChain
Overrides:
getState in class BaseMarkovChain

setState

public MCMCState setState(MultiState state)

getNumSamplers

public int getNumSamplers()

setNumSamplers

public int setNumSamplers(int numSamplers)

getNumAccepted

public int getNumAccepted()

resetNumAccepted

public int resetNumAccepted()

getNumProposed

public int getNumProposed()

resetNumProposed

public int resetNumProposed()

initialize

void initialize()

generate

public MCMCState generate(MultiState currentStateVector)

step

public void step()
Generate the next state from the current state.
Specified by:
step in interface MarkovChain
Overrides:
step in class BaseMarkovChain

iterate

public void iterate(int howmany)
Description copied from interface: MarkovChain
Perform several steps.
Specified by:
iterate in interface MarkovChain
Overrides:
iterate in class BaseMarkovChain
Following copied from interface: org.omegahat.Simulation.MCMC.MarkovChain
Parameters:
n - how many steps

permute

void permute()

acceptanceProb

protected double acceptanceProb(java.lang.Object current,
                                MultiState currentStateVector,
                                java.lang.Object proposed,
                                MultiState proposedStateVector,
                                int which)

logAcceptanceProb

protected double logAcceptanceProb(java.lang.Object current,
                                   MultiState currentStateVector,
                                   java.lang.Object proposed,
                                   MultiState proposedStateVector,
                                   int which)