Coerces a given vector of constants into a random vector with 1 simulation in each component.

rvconst(n = 1, x = 0)

Arguments

n

integer: number of variables to generate

x

a vector of constants

Value

A random vector (rv object) of length n.

Details

Coerces a given vector of constants into a random vector with 1 simulation in each component.

References

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").

Author

Jouni Kerman jouni@kerman.com

Examples


  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