Learn R Programming

ggdmc (version 0.1.3.9)

plot_prior: Plot Prior Probability Density

Description

Plot the i'th member of list created by prior.p.dmc. If trans=TRUE then plot on natural (logarithmic) scale using transform specified in attr(p.prior[[i]],"trans"). This is akin to DMC's plot.prior but uses ggplot2. Use plot.priors to plot all parameters at once.

Usage

plot_prior(i, p.prior, xlim = NA, natural = TRUE, n.point = 100,
  trans = NA, main = "", save.dat = FALSE, ...)

Arguments

i
a numeral or name index indicating which parameter to plot
p.prior
a prior parameter list, created usually by prior.p.dmc
xlim
set the range of on x axis. This is usually the range for each EAM parameter. Default is NA, letting plot facilitate to determine the range automatically.
natural
default TRUE
n.point
default to plot 1e2
trans
default NA. trans can be a scalar or vector.
main
No function. A legency argument for compartibility reason
save.dat
whether to save a data frame for re-plotting
...
other arguments

Details

plot.prior checks if any of the elements in trans is NA. If trans contains NAs, then it 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), then checks what has been set in the "untrans" attribute for the plotted parameter (where the i argument indicates). Otherwise, we set it abitrarily as identity (i.e., stay the same).

Examples

Run this code
pop.prior <- prior.p.dmc(
             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=pop.prior)
plot_prior(2,  p.prior=pop.prior)

Run the code above in your browser using DataLab