coda_df: Create a dataframe from an mcmc.list object

Description Usage Arguments Value Author(s) See Also Examples

Description

coda_df takes as input an mcmc.list object and converts it to a dataframe with a column for each monitored parameter and two indicator columns, one giving the chain number and another giving the iteration number within that chain.

Usage

1
coda_df(coda.object, parameters = NULL)

Arguments

coda.object

an mcmc.list object

parameters

character vector of parameter names to include in dataframe. If none are supplied all monitored parameters are included.

Value

A dataframe

Author(s)

Michael Malick

See Also

data.frame mcmc mcmc.list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(coda)
data(line)

df <- coda_df(line)
head(df)
tail(df)

df <- coda_df(line, parameters = "alpha")
head(df)

df <- coda_df(line, parameters = c("alpha", "beta"))
head(df)

df <- coda_df(line, parameters = grep("sig", coda::varnames(line), value = TRUE))
head(df)

df <- coda_df(line, parameters = grep("a", coda::varnames(line), value = TRUE))
head(df)

df <- coda_df(line, parameters = c("alpha", grep("sig", coda::varnames(line),
              value = TRUE)))
head(df)

MichaelMalick/r-codatools documentation built on May 8, 2019, 9:56 a.m.