john2 wrote: > Lucy wrote: >> Hi all, >> >> I want to generate random numbers that follow truncated Weibull >> distribution. >> >> In Matlab, there is a "wblcdf" function that can generate Weibull >> random numbers, but their support spams the half-line (0, +inf). But >> that's not what I want, I want to derive and generate random numbers >> that fall in (0, d), where "d" is a positive constant. I call this >> "Truncated Weibull distribution", but I am not sure if there is such a >> name existing. >> > > > Usually what is required is just the part of the pdf on [0,d] but > rescaled by its cumulative distribution D(x) value at d. > So W'(x) = W(x)/D(d) 0<x<d > where W(x) is a standard Weibull on [0, inf] > If you're generating random numbers, simply use a standard Weibull, > discard the values which exceed d, and resample, which is the same thing. > That might not be efficient, if D(d)<<1. If it's not, then there are other ideas, such as rejection sampling (which is actually what you're suggesting, but a more efficient proposal distribution could be used), or slice sampling (http://www.cs.toronto.edu/~radford/slice-aos.abstract.html). I'm not going to claim that any one method is better than another, but at least the OP has a couple more options.
-- Bob O'Hara Department of Mathematics and Statistics P.O. Box 68 (Gustaf Hällströmin katu 2b) FIN-00014 University of Helsinki Finland