Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

c95

Compute 95% Credible Interval and Mean


Description

Small helper function that computes the 2.5% and 97.5% quantiles and the mean of a vector. Useful for example when using function predict.bamlss.

Usage

c95(x)

Arguments

x

A numeric vector.

See Also

Examples

x <- rnorm(100)
c95(x)

## Not run: ## Example computing predictions.
set.seed(123)
d <- data.frame("x" = seq(-3, 3, length = 30))
d$y <- sin(d$x) + rnorm(30, sd = 0.3)

## Estimate model and compute predictions.
## with c95().
b <- bamlss(y ~ s(x), data = d)
p <- predict(b, model = "mu", FUN = c95)
plot(d)
matplot(d$x, p, type = "l", lty = c(2, 1, 2),
  col = "black", add = TRUE)

## Example extracting coefficients.
coef(b, FUN = c95)

## End(Not run)

bamlss

Bayesian Additive Models for Location, Scale, and Shape (and Beyond)

v1.1-3
GPL-2 | GPL-3
Authors
Nikolaus Umlauf [aut, cre] (<https://orcid.org/0000-0003-2160-9803>), Nadja Klein [aut] (<https://orcid.org/0000-0002-5072-5347>), Achim Zeileis [aut] (<https://orcid.org/0000-0003-0918-3766>), Meike Koehler [ctb], Thorsten Simon [aut] (<https://orcid.org/0000-0002-3778-7738>), Stanislaus Stadlmann [ctb]
Initial release
2021-01-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.