Plot Sampling Path(s) of Coefficient(s) and Variance(s)
This function plots the sampling paths of coefficient(s) and variance(s) stored in model term
objects typically returned from function bayesx
or read.bayesx.output
.
plotsamples(x, selected = "NA", acf = FALSE, var = FALSE, max.acf = FALSE, subset = NULL, ...)
x |
a vector or matrix, where each column represents a different sampling path to be plotted. |
selected |
a character string containing the term name the sampling paths are plotted for. |
acf |
if set to |
var |
indicates whether coefficient or variance sampling paths are displayed and simply changes the main title. |
max.acf |
if set to |
subset |
integer. An index which selects the coefficients for which sampling paths should be plotted. |
... |
other graphical parameters to be passed to |
Nikolaus Umlauf, Thomas Kneib, Stefan Lang, Achim Zeileis.
## generate some data set.seed(111) n <- 500 ## regressors dat <- data.frame(x = runif(n, -3, 3)) ## response dat$y <- with(dat, 1.5 + sin(x) + rnorm(n, sd = 0.6)) ## Not run: ## estimate model b <- bayesx(y ~ sx(x), data = dat) summary(b) ## plot sampling path for ## the variance plot(b, term = "sx(x)", which = "var-samples") ## plot sampling paths for ## coefficients plot(b, term = "sx(x)", which = "coef-samples") ## plot maximum autocorrelation of ## all sampled parameters of term s(x) plot(b, term = "sx(x)", which = "coef-samples", max.acf = TRUE) ## extract samples of term sx(x) sax <- as.matrix(samples(b, term = "sx(x)")) ## now use plotsamples plotsamples(sax, selected = "sx(x)") ## some variations plotsamples(sax, selected = "sx(x)", acf = TRUE) plotsamples(sax, selected = "sx(x)", acf = TRUE, lag.max = 200) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.