public class RobustAdaptiveMetropolis extends AbstractMetropolis
Constructor and Description |
---|
RobustAdaptiveMetropolis(RealScalarFunction logf,
double targetAcceptance,
Vector initialState,
RandomLongGenerator uniform)
Constructs an instance which assumes an initial variance of 1 per variable, uses a gamma of
0.5.
|
RobustAdaptiveMetropolis(RealScalarFunction logf,
Matrix initialScale,
double gamma,
double targetAcceptance,
Vector initialState,
RandomStandardNormalGenerator rnorm,
RandomLongGenerator uniform)
Constructs a new instance with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isProposalAccepted(Vector currentState,
Vector proposedState)
Decides whether the given proposed state should be accepted, or whether the system should
remain in it's current state.
|
protected Vector |
nextProposedState(Vector currentState)
Proposes a next state for the system.
|
Matrix |
S()
Gets the tuned scaling matrix (this changes each time a new sample is drawn).
|
acceptanceRate, nextVector, seed
public RobustAdaptiveMetropolis(RealScalarFunction logf, Matrix initialScale, double gamma, double targetAcceptance, Vector initialState, RandomStandardNormalGenerator rnorm, RandomLongGenerator uniform)
logf
- the log of the unnormalized pdf from which we wish to sampleinitialScale
- the initial scale matrix, the square root of the covariance matrix,
applied to the vector of independently distributed Normal variables.
This must be a lower triangular matrix with positive diagonal elements.gamma
- a value between 0.5 and 1, that controls the speed of adaption. A
lower gamma will lead to faster adoption.targetAcceptance
- the target acceptance rateinitialState
- the initial state of the algorithmrnorm
- the random standard Normal generator to be useduniform
- the random long generator to be usedpublic RobustAdaptiveMetropolis(RealScalarFunction logf, double targetAcceptance, Vector initialState, RandomLongGenerator uniform)
logf
- the log of the unnormalized pdf from which we wish to sampletargetAcceptance
- the target acceptance rateinitialState
- the initial state of the algorithmuniform
- the random long generator to be usedprotected Vector nextProposedState(Vector currentState)
AbstractMetropolis
nextProposedState
in class AbstractMetropolis
currentState
- the current state of the systemprotected boolean isProposalAccepted(Vector currentState, Vector proposedState)
AbstractMetropolis
isProposalAccepted
in class AbstractMetropolis
currentState
- the current state of the systemproposedState
- the proposed next state of the systempublic Matrix S()
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.