rvfactor {rv} | R Documentation |
Creates or tests for objects of type ``rvfactor
".
rvfactor(x, ...) ## S3 method for class 'rv': rvfactor(x, levels=NULL, ...) is.rvfactor(x) ## S3 method for class 'rvfactor': as.rv(x) as.rvfactor(x, ...)
x |
object to be coerced or tested. |
levels |
factor levels (labels for the levels) |
... |
other arguments |
Internally random factors are integer-valued just like regular factors in R.
rvfactor
: an rvfactor
object.
is.rvfactor
: TRUE
or FALSE
.
as.rv.rvfactor
: an rv
object.
as.rvfactor.rv
: an rvfactor
object.
Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman
Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York. http://www.stat.columbia.edu/~kerman/Research/postsim.pdf
# Probabilities of each integer of trunc(Z) where Z ~ N(0,1) ? x <- rvnorm(1) rvfactor(trunc(x)) rvfactor(x>0) rvfactor(rvpois(1, lambda=0.5))