dMCMCplot: Create a multiple diagnostic plot

Description Usage Arguments Details Value Author(s) See Also Examples

Description

dMCMCplot Create the untimate diagnostic plot for a MCMC chain

Usage

1
2
dMCMCplot(mcmcobject = NULL, interest = NULL, model = NULL,
  Rprior = NULL, ...)

Arguments

mcmcobject

a mcmc object (list of samples).

interest

a set of parameters of interest. These should have true priors (e.g. can be directly related to a prior distribution). Lower-level priors, that depend on a hyperprior, will fail as dMCMC does not attempt to understand the hierachical structure of the model file.

model

the path to the BUGs/JAGS model text file with the priors specified. This model must be the one that generated the MCMC list.

Rprior

the prior function directly specified by the user (as a standard R probabilty density function e.g. prior=dunif).

...

additional parameters (unused). diagnostic plots on. Names must be equal to the names in the jags/bugs model. If length > 1, one plot is produced per parameter of interest, in this case output to a pdf is advised. Otherwise the function forces par(ask=TRUE).

Details

Creates a multipanel graphic with diagnostics on parameter samples

Value

A multipanel plot

Author(s)

Marco D. Visser

See Also

jags.model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
sink("examp.txt")
cat( "
model {
	for (i in 1:N) {
		x[i] ~ dnorm(mu, tau)
	}
	mu ~ dnorm(0, .0001)
	tau <- pow(sigma, -2)
	sigma ~ dunif(0, 100)
    } ",fill=TRUE)
     sink()

jags <- jags.model('examp.txt',
                  data = list('x' = rnorm(100,2,2),
                              'N'=100),
                  n.chains = 4,
                  n.adapt = 100)

mysamples <- coda.samples(jags, c('mu', 'tau'),100)

dMCMCplot(mysamples,"mu","examp.txt")

MarcoDVisser/dMCMC documentation built on May 7, 2019, 2:49 p.m.