Computes variances of the simulations of components of a random vector of array.

rvvar(x)

Arguments

x

an object

Value

A numeric vector or array (of the same dimension as that of x)

Details

rvvar computes the means of the simulations of all individual components of a random vector (rv) object.

That is, rvvar applies the function var to the vector of simulations of each component of x, thus computing "columnwise" variances of the matrix of simulations of x.

rvsd applies the function sd to the vector of simulations of each component of x, thus computing "columnwise" standard deviations of the matrix of simulations of x.

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

Author

Jouni Kerman jouni@kerman.com

Examples


  x <- rvnorm(mean=0, var=1:10)
  rvvar(x)
#>  [1]  1.040558  1.988681  2.604101  3.650395  4.419348  5.619464  6.172546
#>  [8]  6.885114  9.417672 10.037993
  rvsd(x)
#>  [1] 1.020077 1.410206 1.613723 1.910601 2.102224 2.370541 2.484461 2.623950
#>  [9] 3.068823 3.168279