numeric.rv {rv}R Documentation

Numeric Random Vectors

Description

is.numeric(x) returns TRUE if and only if all components of an rv object are numeric.

Usage

  ## S3 method for class 'rv':
  is.numeric(x)
  ## S3 method for class 'rv':
  as.numeric(x, ...)
  ## S3 method for class 'rvfactor':
  is.numeric(x)
  ## S3 method for class 'rvmixed':
  is.numeric(x)

Arguments

x an rv object
... Further arguments passed on

Details

is.numeric(x) returns TRUE if and only if each component of x is numeric-valued (i.e. TRUE/FALSE).

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

Random factors are not numeric; mixtures are.

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 <- as.logical(rvbern(1,0.5)) # Bernoulli rv
  is.numeric(x)           # FALSE
  x <- as.numeric(x)      # coerce to numeric; all TRUEs become ones, FALSEs zeros
  is.numeric(x)           # TRUE

[Package rv version 0.949 Index]