Coerces random vector objects into double-valued ones.
# S3 method for rv
as.double(x, ...)
an rv object
other arguments
as.double
coerces an rv object into double-valued one. In effect,
the function as.double
is applied to all simulations.
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 <- as.logical(rvbern(prob=0.5))
print(x)
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] 0.5 0.5 0 0 0 0 1 1 1 4000
print(as.double(x))
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] 0.5 0.5 0 0 0 0 1 1 1 4000