Maxima and Minima of Random Variables

Description

Returns the maxima and minima of the components of a random vector.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  rvmin(x)
  rvmax(x)
  rvrange(x)
  ## S3 method for class 'rv'
min(..., na.rm=FALSE)
  ## S3 method for class 'rv'
max(..., na.rm=FALSE)
  ## S3 method for class 'rv'
pmin(..., na.rm=FALSE)
  ## S3 method for class 'rv'
pmax(..., na.rm=FALSE)

Arguments

x

an rv or rvsummary object

na.rm

remove missing values?

...

one or more rv objects or numeric objects

Details

rvmin applies the function min to each component of the argument x. Missing values are removed.

rvmax applies the function max to each component of the argument x. Missing values are removed.

rvrange applies the function range to each component of the argument x. Missing values are removed.

min.rv returns the minimum of the random vector, returning thus one random variable. Similarly max.rv returns the maximum of a vector.

pmin.rv and pmax.rv returns the componentwise minima or maxima of several random vectors or constants, yielding thus a random vector of the same length.

Value

A numeric vector of the same dimension as x.

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

rvmedian, rvmean.

Examples

1
2
3
4
  x <- rvpois(10, lambda=3)
  rvmin(x)
  rvmax(x)
  rvrange(x)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.