rNormalPrior returns a random vector generator
rNormalPrior.RdThe return value is a function that generates random vectors of the same size as mean and sd from a multivariate normal distribution with independent components with mean "mean" and standard deviation "sd". The random vectors are returned as n rows of a matrix, where n is the only argument of the returned function.
Arguments
- mean
mean of the random variables (a vector)
- sd
standard deviation of the random variables (same size vector as mean)
Value
an independentent multivariate normal random vector generating function: rprior(n), where n is the requested number of vectors (rows)
Examples
rnp<-rNormalPrior(mean=c(0,1,2),sd=c(1,2,3))
rnp(12)
#> [,1] [,2] [,3]
#> [1,] 1.9741567 4.7693246 -2.765862
#> [2,] -0.5399232 -1.3389229 3.677318
#> [3,] -1.8193472 1.7866879 2.126402
#> [4,] 1.1796642 0.4861576 -1.169008
#> [5,] 0.1987772 2.3010671 3.031740
#> [6,] 1.4775323 1.1440514 8.379334
#> [7,] -1.4761969 1.8157770 6.181933
#> [8,] 0.3602783 2.3091005 5.156466
#> [9,] -1.9795551 3.4167712 1.492160
#> [10,] 0.2950298 3.5326812 -1.406030
#> [11,] -1.1310538 1.2199868 4.558716
#> [12,] -0.2343379 5.1733771 1.667242