Peek: Load samples from a partial MCMC run

Description Usage Arguments Value See Also Examples

View source: R/mcmc.R

Description

Peek allows the samples from a file-backed MCMC to be loaded in another R session while the MCMC is still in progress. By using Peek, the chain's convergence can be monitored before the MCMC chain has finished running.

Usage

1
Peek(backing.path)

Arguments

backing.path

directory path of an in-progress MCMC

Value

list of big.matrix with samples from the partial MCMC run

See Also

InitMcmc, LoadMcmc, big.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
SampleSomething <- function() {
    Sys.sleep(0.1)
    rnorm(1)
}

backing.path <- tempfile()
dir.create(backing.path)
print(backing.path)

SlowMcmc <- InitMcmc(1000, backing.path=backing.path)
SlowMcmc({
    x <- SampleSomething()
})

### In another R process, while the MCMC is still running...
samples.so.far <- Peek(backing.path)
samples.so.far$x[,]

kurtis-s/overature documentation built on Aug. 10, 2019, 10:28 p.m.