MCMCenviron: Class '"MCMCenviron"'

MCMCenviron-classR Documentation

Class "MCMCenviron"

Description

A generic interface for MCMC sampler objects implementing Bayesian models. Methods provide access to underlying functionality implemented in C++. The underlying implementation provides basic functionality for controlling the chain, and a 'tracing buffer' for storing and retrieving the samples.

Extends

All reference classes extend and inherit methods from "envRefClass".

Fields

(All fields are read-only.)

pointer:

external pointer to the C++ object

blobsize:

size (in bytes) of the raw object data for serialization. (currently not implemented.)

seed:

seed of the internal random number generator.

Methods

GENERAL METHODS

Init_Model(output = TRUE, seed=c('auto', 'r.seed')):

Initializes the sampler.

Arguments

output:

logical. Print messages to the screen?

seed:

integer. Seed of the internal RNG. Additionally, seed='auto' autogenerates the seed from the internal clock; seed='r.seed' autogenerates the seed from the current state of the .Random.seed variable.

Update(num_iter, output = TRUE):

Runs num_iter iterations of the sampler. Set output = FALSE to suppress console output.

Get_Iteration():

Retrieves the current number of iterations the sampler.

Get_Param_List():

Retrieves the names of the parameters of the model.

Get_Param(param):

Retrieves the current value of the parameter param.

Set_Seed(seed):

Seeds the internal random number generator. It does not affect R's internal RNG.

Get_Status():

Retrieves the current state of the chain

Value

iteration

numeric. Current iteration

initialized

logical. Is the sampler initialized?

buffer_size

numeric. Capacity (in samples) of the tracing buffer.

buffer_used

numeric. Number of samples currently stored in the tracing buffer.

tracing

character. Names of the variables currently traced.

thinning

numeric. Thinning interval of the tracing buffer.

METHODS FOR CONTROLLING THE TRACING BUFFER

Get_Trace_List():

Retrieves the names of the parameters being currently traced.

Activate_Tracing():

Activates the tracing buffer. Traced variables will be stored in the buffer when generated with Update().

Deactivate_Tracing():

Deactivates the tracing buffer. Calls to Update() will not store samples in the buffer.

Set_Trace(traces):

Adds parameters to tracer.

Arguments

param:

character vector. Names of the parameters to trace. To list the available parameters for tracing use the Get_Param_List() method.

Get_Trace(param):

Retrieves samples stored in the tracing buffer.

Arguments

param:

character. Name of the parameter to retrieve.

Value

An array. The first dimension indexes the sample; the rest correspond to the original dimensions of the parameter as defined in the model.

Reset_Traces():

Deletes the content of the tracing buffer.

Change_SubSamp(new_subsamp):

Changes the sub-sampling period (thinning) of the tracing buffer.

Warning

This operation deletes the current content of the tracing buffer.

Get_Trace_Size():

Retrieves the size (in number of samples) of the trace buffer.

Change_Trace_Length(new_length):

Changes the size (in number of samples) of the tracing buffer.

Warning

This operation deletes the current content of the tracing buffer.

Note

This class is not designed to be used directly, but as a generic interface for samplers implementing specific models.

Author(s)

Daniel Manrique-Vallier

Examples

showClass("MCMCenviron")

LCMCR documentation built on May 29, 2024, 3:30 a.m.