rvcov

rvcov(x, y = NULL, ...)

Arguments

x

a random vector

y

(optional) a random vector

...

further arguments passed to or from other methods

Value

A covariance matrix.

Details

rvcov

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

Author

Jouni Kerman jouni@kerman.com

Examples


  x <- rvnorm(mean=1:3)
  y <- rvnorm(mean=2:4)
  rvcov(x,y)
#>             [,1]         [,2]         [,3]
#> [1,] -0.21577388 -0.059718586  0.049101680
#> [2,]  0.03142875  0.002771382 -0.076454776
#> [3,] -0.08218373  0.077943907  0.009687816
  rvcov(x,x)
#>            [,1]        [,2]        [,3]
#> [1,] 1.04015965  0.02690043  0.02149899
#> [2,] 0.02690043  0.84384211 -0.15999162
#> [3,] 0.02149899 -0.15999162  1.04720032