statalign.mcmc
Class McmcModule

java.lang.Object
  extended by statalign.mcmc.McmcModule
Direct Known Subclasses:
CoreMcmcModule, ModelExtension

public abstract class McmcModule
extends java.lang.Object

Generic class for a group of McmcMove objects. Each ModelExtension is an instance of this class, as is the CoreMcmcModule

Author:
herman

Field Summary
 double curLogLike
          Current log-likelihood contribution
 boolean printExtraInfo
           
 
Constructor Summary
McmcModule()
           
 
Method Summary
 void addMcmcMove(McmcMove m, int weight)
           
 void addMcmcMove(McmcMove m, int weight, int increment)
           
 void afterFirstHalfBurnin()
           
 void afterSampling()
           
 void beforeSampling(Tree tree)
          Called before the start of MCMC sampling, but after the initial tree, alignment etc. have been generated.
 double getLogLike()
           
 java.lang.String getMcmcInfo()
           
 McmcMove getMcmcMove(java.lang.String name)
           
 java.util.List<McmcMove> getMcmcMoves()
           
 int getParamChangeWeight()
           
 void incrementWeights()
           
 boolean isFirstHalfBurnin()
           
 boolean isParamChangeAccepted(double logProposalRatio, McmcMove m)
           
abstract  double logLikeFactor(Tree tree)
          This should return the log of the model's contribution to the likelihood, it will be added on to the log-likelihood of the current point in the MCMC state space.
 double logPrior(Tree tree)
          This should return the log of the total prior calculated for the model parameters.
 void modifyProposalWidths()
           
 boolean proposeParamChange(Tree tree)
           
 void setAllMovesNotProposed()
           
 void setLogLike(double ll)
           
 void setMcmc(Mcmc m)
           
 void setWeight(java.lang.String name, int weight)
           
 void zeroAllMoveCounts()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printExtraInfo

public boolean printExtraInfo

curLogLike

public double curLogLike
Current log-likelihood contribution

Constructor Detail

McmcModule

public McmcModule()
Method Detail

setMcmc

public void setMcmc(Mcmc m)

isFirstHalfBurnin

public boolean isFirstHalfBurnin()

getParamChangeWeight

public int getParamChangeWeight()

setWeight

public void setWeight(java.lang.String name,
                      int weight)

addMcmcMove

public void addMcmcMove(McmcMove m,
                        int weight)

addMcmcMove

public void addMcmcMove(McmcMove m,
                        int weight,
                        int increment)

getMcmcMoves

public java.util.List<McmcMove> getMcmcMoves()

setAllMovesNotProposed

public void setAllMovesNotProposed()

zeroAllMoveCounts

public void zeroAllMoveCounts()

getMcmcMove

public McmcMove getMcmcMove(java.lang.String name)

getMcmcInfo

public java.lang.String getMcmcInfo()

beforeSampling

public void beforeSampling(Tree tree)
Called before the start of MCMC sampling, but after the initial tree, alignment etc. have been generated. Override to initialise data structures etc.

Parameters:
tree - the starting tree

afterSampling

public void afterSampling()

logLikeFactor

public abstract double logLikeFactor(Tree tree)
This should return the log of the model's contribution to the likelihood, it will be added on to the log-likelihood of the current point in the MCMC state space. Normally it will be called once at the initialisation of the MCMC process and from then on once in each MCMC step, when proposing any change. In debug mode, will be called more often (including after proposed changes) to ensure consistency.

Parameters:
tree - current tree
Returns:
log of model extension likelihood, conditional on current tree, alignment and params

getLogLike

public double getLogLike()

setLogLike

public void setLogLike(double ll)

logPrior

public double logPrior(Tree tree)
This should return the log of the total prior calculated for the model parameters. It is only used in parallel mode when proposing swaps between chains. By default returns 0.


proposeParamChange

public boolean proposeParamChange(Tree tree)

modifyProposalWidths

public void modifyProposalWidths()

isParamChangeAccepted

public boolean isParamChangeAccepted(double logProposalRatio,
                                     McmcMove m)

incrementWeights

public void incrementWeights()

afterFirstHalfBurnin

public void afterFirstHalfBurnin()