Coerces a given vector of constants into a random vector with 1 simulation in each component.
rvconst(n = 1, x = 0)
integer: number of variables to generate
a vector of constants
A random vector (rv object) of length n
.
Coerces a given vector of constants into a random vector with 1 simulation in each component.
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
x <- rvconst(x=1:3)
c(x, 4)
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] 1 0 1 1 1 1 1 1 1 1
#> [2] 2 0 2 2 2 2 2 2 2 1
#> [3] 3 0 3 3 3 3 3 3 3 1
#> [4] 4 0 4 4 4 4 4 4 4 1