Learn R Programming

FME (version 1.3.6.3)

Norm: Normal Random Distribution

Description

Generates random parameter sets that are (multi)normally distributed.

Usage

Norm(parMean, parCovar, parRange = NULL, num)

Value

a matrix with one row for each generated parameter set, and one column per parameter.

Arguments

parMean

a vector, with the mean value of each parameter.

parCovar

the parameter variance-covariance matrix.

parRange

the range (min, max) of the parameters, a matrix or a data.frame with one row for each parameter, and two columns with the minimum (1st) and maximum (2nd) column.

num

the number of random parameter sets to generate.

Author

Karline Soetaert <karline.soetaert@nioz.nl>

Details

Function Norm, draws parameter sets from a multivariate normal distribution, as specified through the mean value and the variance-covariance matrix of the parameters. In addition, it is possible to impose a minimum and maximum of each parameter, via parRange. This will generate a truncated distribution. Use this for instance if certain parameters cannot become negative.

See Also

Unif for uniformly distributed random parameter sets.

Latinhyper to generates parameter sets using latin hypercube sampling.

Grid to generate random parameter sets arranged on a regular grid

rnorm the R-default for generating normally distributed random numbers.

Examples

Run this code
## multinormal parameters: variance-covariance matrix and parameter mean
parCovar <- matrix(data = c(0.5, -0.2, 0.3, 0.4, -0.2, 1.0, 0.1, 0.3,
                   0.3, 0.1, 1.5, -0.7, 1.0, 0.3, -0.7, 4.5), nrow = 4)
parCovar

parMean <- 4:1

## Generated sample
Ndist <- Norm(parCovar = parCovar, parMean = parMean, num = 500)
cov(Ndist)   # check
pairs(Ndist, main = "normal")

## truncated multinormal
Ranges <- data.frame(min = rep(0, 4), max = rep(Inf, 4))

pairs(Norm(parCovar = parCovar, parMean = parMean, parRange = Ranges,
      num = 500), main = "truncated normal")

Run the code above in your browser using DataLab