Learn R Programming

rase (version 0.2-22)

post.mcmc: Post-MCMC Handling

Description

Takes the result from an mcmc run (e.g., output from rase) and applies a burnin and a thinning. Optionally it can be transformed into a ggs object that the ggmcmc package can use (for mcmc visualization).

Usage

post.mcmc(res, burnin = 1000, thin = 10, as.ggmcmc = TRUE)

Arguments

res
The output from any mcmc run in (e.g., output from rase). It is effectively a matrix where each column is a different parameter and each row is one iteration of the mcmc sampler.
burnin
Number of iterations to disregard as burnin.
thin
Sample every ith iteration. If no iterations are to be discarted, it should be thin = 1. Note that if thin = 0, then no iteration is saved at all.
as.ggmcmc
If TRUE (default), the object will be transformed into a ggs object.

Value

If as.ggmcmc = TRUE (the default), the function returns a ggs object. This can be used as input to the ggs_* functions in the ggmcmc package. If as.ggmcmc = FALSE, the function returns a matrix where each column is a different parameter and each row is one iteration of the mcmc sampler.

See Also

rase, bm_ase, ggs

Examples

Run this code
#attach the data
data(rase_data, package = 'rase')
	
## Not run: 
# # Explore the data
# str(mcmc)
# 
# # discard the first 200 iterations as burnin 
# #and keep every 10th iteration.
# gg_dat <- post.mcmc(mcmc, burnin=200, thin = 10, as.ggmcmc = TRUE)
# 
# # density using ggmcmc for dispersal rates (sigma).
# require(ggmcmc)
# ggs_density(gg_dat, family = 'sigma')
# ## End(Not run)

Run the code above in your browser using DataLab