removeBurnin: Remove Burnin

View source: R/removeBurnin.R

removeBurninR Documentation

Remove Burnin

Description

Removes burnin from MCMC trace

Usage

removeBurnin(trace, burnin)

Arguments

trace

(list of data frames; no default) Name of a list of data frames, such as produced by readTrace().

burnin

(single numeric value; 0.1) Fraction of generations to discard (if value provided is between 0 and 1) or number of generations (if value provided is greater than 1).

Details

Removes burnin from an MCMC trace, such as the output of readTrace(). If multiple traces are provided, this function will remove the burnin from each.

Value

List of dataframes (of length 1 if only 1 log file provided).

Examples



# download the example dataset to working directory
url_gtr <-
    "https://revbayes.github.io/tutorials/intro/data/primates_cytb_GTR.log"
dest_path_gtr <- "primates_cytb_GTR.log"
download.file(url_gtr, dest_path_gtr)

# to run on your own data, change this to the path to your data file
file_single <- dest_path_gtr

one_trace <- readTrace(paths = file_single)
one_trace_burnin <- removeBurnin(trace = one_trace, burnin = 0.1)

# remove file
# WARNING: only run for example dataset!
# otherwise you might delete your data!
file.remove(dest_path_gtr)



revbayes/RevGadgets documentation built on Jan. 19, 2024, 3:29 p.m.