Displaying 1 result from an estimated 1 matches for "rtlnorm".
Did you mean:
  rlnorm
  
2006 Aug 18
0
Fitting Truncated Lognormal to a truncated data set (was: fitting truncated normal distribution)
...n <- length(n)
   while (length(ret) < n) {
       y <- rlnorm(n - length(ret), mean, sd)
       y <- y[y >= lower & y <= upper]
       ret <- c(ret, y)
   }
   stopifnot(length(ret) == n)
   ret
}
# This is modified off the code for 'rtnorm' of the library(msm).
rtlnorm <- function (n, mean = 0, sd = 1, lower = -Inf, upper = Inf)
{
   ret <- numeric()
   if (length(n) > 1)
       n <- length(n)
   while (length(ret) < n) {
       y <- rlnorm(n - length(ret), mean, sd)
       y <- y[y >= lower & y <= upper]
       ret <- c(ret, y)...