ggplotbayesfuns: Plots to assess the mixing of the Chains

Description Usage Arguments Value Author(s) Examples

Description

Compute the ggplots for each parameter of interest in a single page.

Usage

1
2
3
4
5
6
chains.plotOwn(data, vline.red = min(data$iter),
  post.mean.green = apply(data, 2, mean), ...,
  title = "TracePlots of the generated Chains ")

mixchains.Own(data, moreplot = F, burnin.redline = 0, legend2 = F,
  title = "TracePlots of the generated Chains ")

Arguments

data

numeric vector containing the GEV block-maxima

vline.red

draws a dashed red line in red representing the starting of the iterations , thus removing the burn-in period.

post.mean.green

draws a green dashed line representing the posterior mean of the parameter's chain

...

Other parameters from gridExtra::grid.arrange()

title

Global title for the plot

Value

a grid.arrange() of ggplots.

Author(s)

Antoine Pissoort, antoine.pissoort@student.uclouvain.be

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
data("max_years")
fn <- function(par, data) -log_post0(par[1], par[2], par[3], data)
param <- c(mean(max_years$df$Max),log(sd(max_years$df$Max)), 0.1 )
# opt <- optim(param, fn, data = max_years$data,
#              method="BFGS", hessian = TRUE)
opt <- nlm(fn, param, data = max_years$data,
           hessian=T, iterlim = 1e5)
start <- opt$estimate
Sig <- solve(opt$hessian)
ev <- eigen( (2.4/sqrt(2))^2 * Sig)
varmat <- ev$vectors %*% diag(sqrt(ev$values)) %*% t(ev$vectors)
# (MH)
set.seed(100)
mh.mcmc1 <- MH_mcmc.own(start, varmat %*% c(.1,.3,.4))
mh.mcmc1$mean.acc_rates

chains.plotOwn(mh.mcmc1$out.chain)

# (GIBBS)
# k chains with k different starting values
set.seed(100)
gibbs.trend <- gibbs.trend.own(start, propsd = c(.5, 1.9, .15, .12),
                              iter = 1000)
## TracePlots
chain.mix <- cbind.data.frame(gibbs.trend$out.chain,
                             iter.chain = rep(1:500, 4))
mixchains.Own(chain.mix)

proto4426/PissoortThesis documentation built on May 26, 2019, 10:31 a.m.