Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RAM_sample(logtarget, x0, M0, n; opt_α=0.234, γ=2/3, q=Normal(), show_progress
* `γ`: a parameter for the computation of the step size sequence.
* `q`: the proposal distribution.
* `show_progress`: a flag that controls whether a progress bar is shown.
* `nsampled`: in sequential application of `RAM_sample`, provide the number of global steps so far to yield consistent updates on the covariance matrix.
* `output_log_probability_x`: a flag that controls whether to include output for the log-posterior scores from each Markov chain iteration.

The function returns a `NamedTuple` with three (or optionally four) elements:
Expand Down
5 changes: 4 additions & 1 deletion src/RobustAdaptiveMetropolisSampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function RAM_sample(
γ=2 / 3,
q=Normal(),
show_progress::Bool=true,
nsampled::Int=0,
output_log_probability_x::Bool=false
)

Expand Down Expand Up @@ -85,7 +86,9 @@ function RAM_sample(
# Step R3

# This is taken from the second paragraph of section 5
η = min(1, d * i^-γ)
# A sequential application of RAM_Sample requires knowledge on the number of already
# processed steps.
η = min(1, d * (nsampled + i)^-γ)

# Compute the new covariance matrix
M = s.L * (I + η * (α - opt_α) * (u * u') / norm(u)^2 ) * s.L'
Expand Down