readMCMC: MCMC Reader

View source: R/RUI.R

readMCMCR Documentation

MCMC Reader

Description

Read raw MCMC samples, return cooked (burnt & sliced) ones

Usage

readMCMC(
  file = "Results_Cooking.txt",
  burnFactor = 0,
  slimFactor = 1,
  sep = "",
  reportFile = NULL,
  panelPerCol = 10,
  panelHeight = 3,
  panelWidth = 23/panelPerCol
)

Arguments

file

Character, full path to MCMC file.

burnFactor

Numeric, burn factor. 0.1 means the first 10 are discarded.

slimFactor

Integer, slim factor. 10 means that only one iteration every 10 is kept.

sep

Character, separator used in MCMC file.

reportFile

Character, full path to pdf report file, not created if NULL

panelPerCol

Integer, max number of panels per column

panelHeight

Numeric, height of each panel

panelWidth

Numeric, width of each panel

Value

A data frame containing the cooked mcmc samples.

Examples

# Create Monte Carlo samples and write them to file
n=4000
sim=data.frame(p1=rnorm(n),p2=rlnorm(n),p3=runif(n))
workspace=tempdir()
write.table(sim,file=file.path(workspace,'MCMC.txt'),row.names=FALSE)
# Read file, burn the first half and keep every other row
M=readMCMC(file=file.path(workspace,'MCMC.txt'),burnFactor=0.5,slimFactor=2)
dim(M)

BaM-tools/RBaM documentation built on April 11, 2025, 10:01 p.m.