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.2410135 1.29636515 1.010766
#> [2,] -1.0214183 1.96307918 9.055210
#> [3,] 1.1582062 0.67170884 5.322609
#> [4,] 2.2279330 0.03786764 -1.366797
#> [5,] 0.1368922 2.11521990 1.909340
#> [6,] 0.9390624 1.17172195 5.968638
#> [7,] -0.4584877 -0.33573320 3.369970
#> [8,] 0.6942220 -1.26469488 1.472362
#> [9,] 0.3353003 2.63892133 -2.543640
#> [10,] 0.8622715 -4.09067731 2.313905
#> [11,] -1.6093373 -0.71021108 3.022323
#> [12,] -1.0227108 1.51836880 1.902129