random_number_generator: Random number generator

Description Usage Arguments Value Author(s) See Also Examples

Description

Return a vector of n random numbers following a truncated distribution (dist) in agreement with a fitted parameters "Fited"

Usage

1
random_number_generator(n, Fited, dist, a, b)

Arguments

n

The number of desired generated numbers

Fited

A list contaning the parameters obtained by application of Fit_dist_parameter

dist

Character vector indicating the distribution to be applied:"norm", "lnorm", "geom", "exp", "pois", "cauchy", "logis", "weibull"

a

Truncation Lower limit

b

Truncation Upper limit

Value

A vector of n random numbers

Author(s)

F. Barrio-Parra

See Also

Fit_dist_parameter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(123)
a <- rnorm(n = 100, mean = 10, sd = 1)
Fit <- Fit_dist_parameter(a)

b <-random_number_generator(n = 10000, Fited = Fit, 
                            dist = "norm", a =8, b = 12)

par(mfrow=c(2,1))

hist(a,xlim= c(7,14))
hist(b,xlim= c(7,14))

EnviroPRA documentation built on May 1, 2019, 8:21 p.m.