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.)
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")
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LCMCR)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LCMCR/MCMCenviron.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MCMCenviron-class
> ### Title: Class '"MCMCenviron"'
> ### Aliases: MCMCenviron-class
>
> ### ** Examples
>
> showClass("MCMCenviron")
Class "MCMCenviron" [package "LCMCR"]
Slots:
Name: .xData
Class: environment
Extends:
Class "envRefClass", directly
Class ".environment", by class "envRefClass", distance 2
Class "refClass", by class "envRefClass", distance 2
Class "environment", by class "envRefClass", distance 3, with explicit coerce
Class "refObject", by class "envRefClass", distance 3
Known Subclasses: "lcm_CR_Basic"
>
>
>
>
>
> dev.off()
null device
1
>