Learn R Programming

ggdmc (version 0.2.5.2)

plot_prior: Plot Prior Distributions

Description

plot_prior plots the ith member of the list created by BuildPrior. If trans = TRUE, the function will plot on natural (logarithmic) scale using transform specified in attr(p.prior[[i]], "trans"). plot.prior plots all parameters at once.

Usage

plot_prior(i, prior, xlim = NA, natural = TRUE, npoint = 100,
  trans = NA, save = FALSE, ...)

# S3 method for prior plot(x, save = FALSE, ...)

Arguments

i

an integer or a character string indicating to plot which parameter

prior

a list of list storing prior setting.

xlim

set the range of on x axis. This is usually the range for each parameter.

natural

default TRUE

npoint

default to plot 100

trans

default NA. trans can be a scalar or vector.

save

whether to save the data out

...

other plotting arguments passing throught dot dot dot.

x

prior distributions

Details

NOTE: the tran function is not thoroughtly checked. Use it with your own risk. plot_prior checks if any of the elements in trans is NA. It then checks if natural is set TRUE (by default it's TRUE). If natural is set also TRUE (i.e., the user wants to do transformation), it then checks what has been set in the "untrans" attribute for the i'th parameter. Otherwise, its default is set all parameters as identity.

Examples

Run this code
# NOT RUN {
p.prior <- BuildPrior(
           dists = rep("tnorm", 7),
           p1    = c(a = 2,   v.f1 = 4,  v.f2 = 3,  z = 0.5, sv = 1,  sz = 0.3, t0 = 0.3),
           p2    = c(a = 0.5, v.f1 = .5, v.f2 = .5, z = 0.1, sv = .3, sz = 0.1, t0 = 0.05),
           lower = c(0,-5, -5, 0, 0, 0, 0),
           upper = c(5, 7,  7, 1, 2, 1, 1))

plot_prior("a", p.prior)
plot_prior(2, p.prior)

print(p.prior)
plot(p.prior)

## require(ggplot2)
## p2 <- ggplot(d, aes(x = xpos, y = ypos)) + geom_line() +
##       facet_wrap(~gpvar, scales="free") + theme_bw(base_size =14)
# }

Run the code above in your browser using DataLab