rNormalPrior returns a random vector generator
rNormalPrior.Rd
The 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,] -0.35612442 -1.12892842 5.2313496
#> [2,] 1.18157557 1.39678419 0.7987843
#> [3,] 0.61615428 4.94831350 7.6539870
#> [4,] -1.58862055 -0.07984633 -1.5083844
#> [5,] 0.55910599 -2.63869449 3.1800319
#> [6,] 0.04213411 3.35932835 1.2292365
#> [7,] -1.05633610 1.39755441 3.9516007
#> [8,] 0.34391334 3.95506462 2.2160771
#> [9,] 2.12644453 -1.95239381 3.2236655
#> [10,] 1.39397780 1.72055659 3.9636508
#> [11,] 1.05215542 -2.95911025 5.6251568
#> [12,] -0.16928008 1.59005951 5.7990218