An implementation of the Metropolis-Hastings algorithm for the generation of a Markov chain.
Gets the number of accepted steps.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mcmc_sampler), | intent(in) | :: | this |
The mcmc_sampler object. |
The number of accepted steps.
Gets a copy of the stored Markov chain.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(chain_builder), | intent(in) | :: | this |
The chain_builder object. |
||
real(kind=real64), | intent(in), | optional | :: | bin |
An optional input allowing for a burn-in region. The parameter represents the amount (percentage-based) of the overall chain to disregard as "burn-in" values. The value shoud exist on [0, 1). The default value is 0 such that no values are disregarded. |
|
class(errors), | intent(inout), | optional, | target | :: | err |
The error handling object. |
The resulting chain with each parameter represented by a column.
Gets the length of the chain (number of stored state variables).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(chain_builder), | intent(in) | :: | this |
The chain_builder object. |
The chain length.
Gets the number of state variables.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(chain_builder), | intent(in) | :: | this |
The chain_builder object. |
The number of state variables.
Currently, this routine does nothing and is a placeholder for the user that inherits this class to provide functionallity upon acceptance of a proposed value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mcmc_sampler), | intent(inout) | :: | this |
The mcmc_sampler object. |
||
integer(kind=int32), | intent(in) | :: | iter |
The current iteration number. |
||
real(kind=real64), | intent(in) | :: | alpha |
The proposal probabilty term used for acceptance criteria. |
||
real(kind=real64), | intent(in), | dimension(:) | :: | xc |
An N-element array containing the current state variables. |
|
real(kind=real64), | intent(in), | dimension(size(xc)) | :: | xp |
An N-element array containing the proposed state variables that were just accepted. |
|
class(errors), | intent(inout), | optional, | target | :: | err |
An error handling object. |
Currently, this routine does nothing and is a placeholder for the user that inherits this class to provide functionallity upon rejection of a proposed value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mcmc_sampler), | intent(inout) | :: | this |
The mcmc_sampler object. |
||
integer(kind=int32), | intent(in) | :: | iter |
The current iteration number. |
||
real(kind=real64), | intent(in) | :: | alpha |
The proposal probabilty term used for acceptance criteria. |
||
real(kind=real64), | intent(in), | dimension(:) | :: | xc |
An N-element array containing the current state variables. |
|
real(kind=real64), | intent(in), | dimension(size(xc)) | :: | xp |
An N-element array containing the proposed state variables that were just rejected. |
|
class(errors), | intent(inout), | optional, | target | :: | err |
An error handling object. |
Pushes a new set of state variables onto the buffer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(chain_builder), | intent(inout) | :: | this |
The chain_builder object. |
||
real(kind=real64), | intent(in), | dimension(:) | :: | x |
The new N-element state array. |
|
class(errors), | intent(inout), | optional, | target | :: | err |
The error handling object. |
Resets the object and clears out the buffer storing the chain values.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(chain_builder), | intent(inout) | :: | this |
The chain_builder object. |
Samples the distribution using the Metropolis-Hastings approach.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mcmc_sampler), | intent(inout) | :: | this |
The mcmc_sampler object. |
||
real(kind=real64), | intent(in), | dimension(:) | :: | xdata |
An M-element array containing the independent coordinate data points. |
|
real(kind=real64), | intent(in), | dimension(:) | :: | ydata |
An M-element array containing the dependent coordinate data points. |
|
class(mcmc_proposal), | intent(inout) | :: | prop |
A proposal generation object. |
||
class(mcmc_target), | intent(inout) | :: | tgt |
An mcmc_target-based object containing the model and allowing for evaluation of likelihoods. |
||
integer(kind=int32), | intent(in), | optional | :: | niter |
An optional input defining the number of iterations to take. The default is 10,000. |
|
class(errors), | intent(inout), | optional, | target | :: | err |
The error handling object. |