plot.PriorsmcmcComposite: Plot a prior defined with setPriors function

View source: R/plot.PriorsmcmcComposite.R

plot.PriorsmcmcCompositeR Documentation

Plot a prior defined with setPriors function

Description

Create a ggplot graph with prior.
The function makes minimal effort to decorate the plot.

Usage

## S3 method for class 'PriorsmcmcComposite'
plot(x, parameter = 1, ...)

Arguments

x

The priors to show

parameter

The name or rank of prior to show

...

Not used

Details

plot.PriorsmcmcComposite plot a prior

Value

A ggplot object

Author(s)

Marc Girondot marc.girondot@gmail.com

See Also

Other mcmcComposite functions: MHalgoGen(), as.mcmc.mcmcComposite(), as.parameters(), as.quantiles(), merge.mcmcComposite(), plot.mcmcComposite(), setPriors(), summary.mcmcComposite()

Examples

## Not run: 
library("HelpersMG")
par <- c(a0=10, a1=2, b2=20, b1=-1)
rules <- rbind(data.frame(Name="^a", Min=0, Max="x*2"), 
              data.frame(Name="^b", Min=0, Max=100))
p <- setPriors(par=par, se=NULL, density="dgamma", rules=rules)
plot(p, parameter="a0")
q <- plot(p, parameter="b1")
q + geom_line(color = "red") + theme_bw() + 
theme(plot.margin=unit(c(2,1,1,1), 'cm'), 
      panel.border = element_blank(), 
      axis.line.x.bottom = element_line(colour = "black"), 
      axis.line.y.left = element_line(colour = "black")) + 
labs(title="Parameter: b1") + theme(plot.title = element_text(hjust = 0.5))

## End(Not run)

HelpersMG documentation built on Sept. 12, 2024, 9:35 a.m.