relabel_samples: Relabel requested burn-in samples as adaptation

Description Usage Arguments Value Further information Examples

View source: R/store.R

Description

Given a sampler object and a vector of sample indices, relabel the given samples to be adaptation samples. This will allow them to be used in the calculation of the conditional distribution for efficient sampling.

Usage

1
relabel_samples(sampler, indices, from = "burn", to = "adapt")

Arguments

sampler

The pmwgs object that we are relabelling samples from

indices

The sample iterations from burn-in to relabel

from

The stage you want to re-label from. Default is "burn"

to

The stage you want to relabel to. Default is "adapt"

Value

The pmwgs object with re-labelled samples

Further information

This should not usually be needed, however if you have a model that is slow to fit, and upon visual inspection and/or trace analysis you determine that during burn-in the samples had already approached the posterior distribution then you can use this function to re-label samples from that point onwards to be classed as adaptation samples.

This will allow them to be used in tests that check for the number of unique samples, and in the building of the conditional distribution (which is used for efficient sampling)

If all old samples do not match 'from' then an error will be raised.

Examples

1
new_pmwgs <- relabel_samples(sampled_forstmann, 17:21)

pmwg documentation built on Feb. 17, 2021, 9:07 a.m.