Learn R Programming

EMC2 (version 3.1.1)

plot.emc: Plot Function for emc Objects

Description

Makes trace plots for model parameters.

Usage

# S3 method for emc
plot(
  x,
  stage = "sample",
  selection = c("mu", "sigma2", "alpha"),
  layout = NA,
  ...
)

Value

A trace/acf plot of the selected MCMC chains

Arguments

x

An object of class emc

stage

A character string indicating the sampling stage to be summarized. Can be preburn, burn, adapt, or sample.

selection

A character vector indicating the parameter group(s). Defaults to mu, sigma2, and alpha.

layout

A vector indicating which layout to use as in par(mfrow = layout). If NA, will automatically generate an appropriate layout.

...

Optional arguments that can be passed to get_pars or plot.default (see par())

Details

If an emc object that has not been run with fit yet is supplied prior plots will be returned.

Examples

Run this code
plot(samples_LNR)
# Or trace autocorrelation for the second subject:
plot(samples_LNR, subject = 2, selection = "alpha")

# Can also plot the trace of for example the group-level correlation:
plot(samples_LNR, selection = "correlation", col = c("green", "purple", "orange"), lwd = 2)

Run the code above in your browser using DataLab