Norm: Normal Random Distribution

View source: R/Norm.R

NormR Documentation

Normal Random Distribution

Description

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

Usage

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

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.

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.

Value

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

Note

For function Norm to work, parCovar must be a valid variance-covariance matrix. (i.e. positive definite). If this is not the case, then the function will fail.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

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

## 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")


FME documentation built on July 9, 2023, 5:59 p.m.