Class MetropolisUtils


  • public final class MetropolisUtils
    extends Object
    Utility functions for Metropolis algorithms.
    • Method Detail

      • isProposalAccepted

        public static boolean isProposalAccepted​(RealScalarFunction logf,
                                                 RandomLongGenerator uniform,
                                                 Vector currentState,
                                                 Vector proposedState)
        Uses the given LOG density function to determine whether the given state transition should be accepted.
        Parameters:
        logf - the log density function
        uniform - the random long generator
        currentState - the current state
        proposedState - the proposed next state
        Returns:
        true if the proposed state should be accepted
      • logAcceptanceRatio

        public static double logAcceptanceRatio​(RealScalarFunction logf,
                                                Vector currentState,
                                                Vector proposedState)
        Computes the log of the acceptance ratio.
        Parameters:
        logf - the log density function
        currentState - the current state
        proposedState - the proposed next state
        Returns:
        the log of the acceptance ratio