as.integer.rv: Integer Random vectors

Description Usage Arguments Details Note Author(s) References See Also Examples

Description

Coerces a random variable to an integer-valued (discrete) one

Usage

1
2
## S3 method for class 'rv'
as.integer(x, ...)

Arguments

x

an rv object

...

Further arguments passed on

Details

In effect, the function as.integer is applied to all simulations.

Note

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

Author(s)

Jouni Kerman jouni@kerman.com

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

See Also

as.logical.rv.

Examples

1
2
3
4
5
6
  x <- rvpois(lambda=3)   # some integer-valued random variable
  print(x)
  is.integer(x)           # FALSE, because by default x is 'double'!
  x <- as.integer(x)      # coerce to integer
  is.integer(x)           # TRUE
  print(x)                # Shows also the 'min' and 'max' columns

jsta/rv documentation built on Feb. 12, 2022, 5:13 p.m.