rvnorm {rv} | R Documentation |
Generates a random vector from a Gaussian sampling model.
rvnorm(n=1, mean=0, sd=1, var=NULL, precision)
n |
integer: number of variables to generate |
mean |
mean, may be a rv |
sd |
standard deviation; scalar or vector (constant or rv, not matrix) |
var |
variance, can be given instead of sd. Scalar, vector, or matrix. |
precision |
inverse variance or variance matrix, may be given instead of sd or var |
A random vector (rv object) of length n
.
If any of the arguments are random,
the resulting simulations may have non-normal marginal distributions;
for example, if an inverse-chi-squared scalar rv var
and zero mean
is given, the resulting rv will have a t-distribution.
Jouni Kerman jouni@kerman.com
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")
.
x <- rvnorm(mean=1:10, sd=1:10) # A vector of length 10. Sigma <- diag(1:10) y <- rvnorm(mean=1:10, var=Sigma)