integer.rv {rv}R Documentation

Integer-valued Random Vectors

Description

Tests or coerces (numeric or logical-valued) random vector objects into integer-valued ones.

Usage

  ## S3 method for class 'rv':
  is.integer(x)
  ## S3 method for class 'rv':
  as.integer(x, ...)

Arguments

x an rv object
... other arguments

Details

is.integer(x) returns TRUE if and only if each component of x is integer-valued.

as.integer.rv coerces an rv object into integer-valued one. In effect, the function as.integer is applied to all simulations.

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.

See Also

logical.rv

Examples

  x <- rvpois(lambda=1)   # some integer-valued random variable
  is.integer(x)           # FALSE, because by default x is 'double'!
  x <- as.integer(x)      # coerce to integer
  is.integer(x)           # TRUE

[Package rv version 0.949 Index]