trace_rjMCMC: Extract trace

View source: R/trace_rjMCMC.R

trace_rjMCMCR Documentation

Extract trace

Description

Burn and thin the MCMC chain(s).

Usage

trace_rjMCMC(rj.dat, burn = NULL, thin = 1)

Arguments

rj.dat

MCMC object of class rjmcmc, as returned by run_rjMCMC.

burn

Number of iterations to discard as burn-in.

thin

Thinning interval. Retains every thin iteration(s).

Details

Adapted from the fitR package https://github.com/sbfnk/fitR.

Value

A list object of class rjtrace containing the trace in mcmc.list format as well as additional information needed for the derivation of dose-response curves.

Author(s)

Phil J. Bouchet

See Also

run_rjMCMC

Examples

## Not run: 
library(espresso)

# Import the example data, excluding species with sample sizes < 5
# and considering the sonar covariate
mydat <- read_data(file = NULL, min.N = 5, covariates = "sonar") 
summary(mydat)

# Configure the sampler
mydat.config <- configure_rjMCMC(dat = mydat,
                                 model.select = TRUE,
                                 covariate.select = FALSE,
                                 function.select = FALSE,
                                 n.rep = 100)
summary(mydat.config)

# Run the reversible jump MCMC
rj <- run_rjMCMC(dat = mydat.config,
                 n.chains = 2,
                 n.burn = 100,
                 n.iter = 100,
                 do.update = FALSE)

# Burn and thin
rj.trace <- trace_rjMCMC(rj.dat = rj)

## End(Not run)

pjbouchet/espresso documentation built on July 27, 2024, 12:31 p.m.