Class MetropolisUtils
- java.lang.Object
-
- dev.nm.stat.random.rng.multivariate.mcmc.metropolis.MetropolisUtils
-
public final class MetropolisUtils extends Object
Utility functions for Metropolis algorithms.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static double
logAcceptanceRatio(RealScalarFunction logf, Vector currentState, Vector proposedState)
Computes the log of the acceptance ratio.
-
-
-
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 functionuniform
- the random long generatorcurrentState
- the current stateproposedState
- 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 functioncurrentState
- the current stateproposedState
- the proposed next state- Returns:
- the log of the acceptance ratio
-
-