search for: dtlnorm

Displaying 1 result from an estimated 1 matches for "dtlnorm".

Did you mean: dlnorm
2006 Aug 18
0
Fitting Truncated Lognormal to a truncated data set (was: fitting truncated normal distribution)
...ng to fit Truncated Lognormal to a data set that is 'truncated' from above a certain value, say, 0.01. Below is what I was able to come up with. I would appreciate it if you could review and make any necessary changes. # This is modified off the code for 'dtnorm' of library(msm). dtlnorm <- 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)...