GenerateWithinBounds: Constrained random numbers generator

View source: R/Distributions_lib.R

GenerateWithinBoundsR Documentation

Constrained random numbers generator

Description

Generate random realizations from a distribution, constraining these realizations to stay within bounds.

Usage

GenerateWithinBounds(dist, par, n = 1, lowerBound = -Inf, higherBound = Inf)

Arguments

dist

character, distribution name

par

numeric vector, parameter vector

n

integer, number of values to generate

lowerBound

Numeric, lower bound

higherBound

Numeric, higher bound, should be strictly larger than the lower bound

Value

The generated values as a numeric vector.

Examples

set.seed(123456)
y0=GenerateWithinBounds(dist='GEV',par=c(0,1,-0.2),n=1000)
y1=GenerateWithinBounds(dist='GEV',par=c(0,1,-0.2),n=1000,lowerBound=0,higherBound=5)
plot(y0);points(y1,col='red')

HydroPortailStats documentation built on Sept. 12, 2024, 9:36 a.m.