Skip to contents

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.

Usage

rNormalPrior(mean, sd)

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.71344025  1.99936029  1.855979
#>  [2,]  0.05629101 -0.84066982  7.050126
#>  [3,] -1.50338393 -0.08969677  4.536242
#>  [4,]  0.58183250  0.32855054  4.449145
#>  [5,] -2.12602728  2.58528791  5.202943
#>  [6,] -1.03912656 -0.16640457  2.308172
#>  [7,]  0.11358926  1.44939579  3.144362
#>  [8,] -0.88863279 -1.71372730  4.208007
#>  [9,] -0.30474337  2.92525315  1.363984
#> [10,] -0.99230322  1.68617608  4.040845
#> [11,] -0.55345831  1.97010493  1.178400
#> [12,] -0.41983615  1.75064990 -1.405844