Description Usage Arguments Details Value Examples
Plots the convergence plots on the parameters from gold
.
1 | gold_mcmcplots(duos_output, type = "traceplot", plots = "all", burnin = 1)
|
gold_output |
The list returned by |
type |
The type of convergent plot to create (see details). |
npar |
The number of paramters to plot. 3X3 grids of tracepltos are created (DEFAULT is 9). |
burnin |
The desired burnin to discard from the results. By default, it is 1 so that all iterations are plotted. |
Options for type
There are several options on which convergence plots to create.
"traceplot"
: Creates trace plots on the parameters (DEFAULT).
"acf"
: Creates autocorrelation plots using lag=1000. The burnin should be set to the desired value to discard.
"rm"
: Creates running mean plots on the parameters.
If npar
is specified to be 9, 9 paramters (as equally spaced as possible) are chosen to plot.
A plot of trace plots, acf plots, or running mean pltos.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.