duos_mcmcplots: Plots a Variety of Convergence Diagnostic Plots

Description Usage Arguments Details Value Examples

Description

Plots the convergence plots on the parameters from duos.

Usage

1
duos_mcmcplots(duos_output, type = "traceplot", parameters = "c", plots = "all", burnin = 1)

Arguments

duos_output

The list returned by duos containing the density estimate results.

type

The type of convergent plot to create (see details).

parameters

The group of parameters to plot (see details).

plots

An option to plot parameters on the same plot or as individuals in a grid (see details).

burnin

The desired burnin to discard from the results. By default, it is 1 so that all iterations are plotted.

Details

Options for parameters

There are two sets of parameters that can plotted in the trace plots: the cut-points and the bin proportion parameters.

Options for type

There are several options on which convergence plots to create.

Options for plots

There are several options on how to display the trace plots.

Value

A plot of trace plots, acf plots, or running mean pltos.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## --------------------------------------------------------------------------------
## Uniform Distribution
## --------------------------------------------------------------------------------

# First run 'duos' on data sampled from a Uniform(0,1) distribution with 50 data points.
y <- runif(50)
duos_unif <- duos(y = y)

# Plot the trace plots of the cut-points on a single graph (trace plot is the default)
duos_mcmcplots(duos_unif)

# Plot the acf plots of the cut-points on separate graphs
duos_mcmcplots(duos_unif, type = "acf", plots = "indiv", burnin = 10000)

## --------------------------------------------------------------------------------
## Beta Distribution
## --------------------------------------------------------------------------------

# First run 'duos' on data sampled from a Beta(0.5,0.5) distribution with 300 data points.
y <- rbeta(300, 0.5, 0.5)
duos_arcsin <- duos(y = y, k = 10, MH_N = 20000)

#Plot the trace plots for the cut-points as individual graphs
#Note: The plots are printed six at a time so multiple panels are printed
duos_mcmcplots(duos_arcsin, plots = "indiv")

#Plot the trace plots for the bin proportions as individual graphs
#Note: The plots are printed six at a time so multiple panels are printed
duos_mcmcplots(duos_arcsin, parameters = "p", plots = "indiv")

## --------------------------------------------------------------------------------
## Bimodal Distribution
## --------------------------------------------------------------------------------

# Sample 150 random uniforms
u <- runif(150)
y <- rep(NA, 150)
# Sampling from the mixture
for(i in 1:150){
  if(u[i]<.3){
   y[i] <- rnorm(1, 0, 1)
  }else {
   y[i] <- rnorm(1, 4, 1)
  }
}
# First run 'duos' on data sampled from a bimodal distribution with 150 data points.
duos_bimodal <- duos(y = y, k = 8, MH_N = 20000)

# Plot the running mean plots for the cut-point parameters 
duos_mcmcplots(duos_bimodal, type = "rm", parameters = "c")

# Plot the autocorrelation plots for the bin proportions with a burnin of 10,000
duos_mcmcplots(duos_bimodal, type = "acf", parameters = "p", burnin = 10000)

reykp/biRd documentation built on May 17, 2019, 8:16 p.m.