rvfactor {rv}R Documentation

Categorical Random Variables (Random Factors)

Description

Creates or tests for objects of type ``rvfactor".

Usage

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

Arguments

x object to be coerced or tested.
levels factor levels (labels for the levels)
... other arguments

Details

Internally random factors are integer-valued just like regular factors in R.

Value

rvfactor: an rvfactor object.
is.rvfactor: TRUE or FALSE.
as.rv.rvfactor: an rv object.
as.rvfactor.rv: an rvfactor object.

Note

Author(s)

Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman

References

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

See Also

Examples

  # 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))

[Package rv version 0.949 Index]