Skip to content
Prev 258299 / 398502 Next

how to generate a normal distribution with mean=1, min=0.2, max=0.8

On Apr 28, 2011, at 12:09 PM, Ravi Varadhan wrote:

            
Perhaps not joking and perhaps not with correct statistical  
specification.

A truncated Normal could be simulated with:

set.seed(567)
x <- rnorm(n=50000, m=1, sd=1)
xtrunc <- x[x>=0.2 & x <=0.8]
require(logspline)
plot(logspline(xtrunc, lbound=0.2, ubound=0.8, nknots=7))