Learn R Programming

shrinkTVP (version 3.0.1)

plot.shrinkTVP: Graphical summary of posterior distribution

Description

plot.shrinkTVP generates plots visualizing the posterior distribution.

Usage

# S3 method for shrinkTVP
plot(
  x,
  pars = c("beta"),
  nplot = 3,
  h_borders = c(0.05, 0.05),
  w_borders = c(0.02, 0.02),
  ...
)

Value

Called for its side effects and returns invisibly.

Arguments

x

a shrinkTVP object.

pars

a character vector containing the names of the parameters to be visualized. The names have to coincide with the names of the list elements of the shrinkTVP object. Throws an error if any element of pars does not fulfill this criterium. The default is c("beta").

nplot

positive integer that indicates the number of tvp plots to display on a single page before a new page is generated. The default value is 3.

h_borders

single real, positive number smaller than 0.5 or a vector containing two such numbers. Determines the relative amount of space (the total amount summing up to 1) left blank on the left and right of the plot, in that order. The default is c(0.05, 0.05).

w_borders

single real, positive number smaller than 0.5 or a vector containing two such numbers. Determines the relative amount of space (the total amount summing up to 1) left blank at the top and bottom of the plot, in that order. The default is c(0.02, 0.02).

...

further arguments to be passed to the respective plotting functions.

Author

Peter Knaus peter.knaus@wu.ac.at

See Also

Other plotting functions: plot.mcmc.tvp(), plot.shrinkTVP_forc()

Examples

Run this code
# \donttest{
set.seed(123)
sim <- simTVP(theta = c(0.2, 0, 0), beta_mean = c(1.5, -0.3, 0))
data <- sim$data

output <- shrinkTVP(y ~ x1 + x2, data)
plot(output)
# }

## Will produce an error because 'hello' is not a parameter in the model
if (FALSE) {
plot(output, pars = c("beta", "hello"))
}

Run the code above in your browser using DataLab