powered by
imp contains a general function for rejection sampling of standardized truncated univariate normal distribution in (a,b).
imp
imp(a, b)
lower bound for truncation.
upper bound for truncation (must be > a).
> a
imp returns a list x: sampled value; and acc: total number of draw used.
x
acc
# NOT RUN { imp(1,Inf) # Case 1: [a,infty) imp(-1,1) # Case 2: 0 in [a,b], a<0<b imp(1,2) # Case 3: [a,b], a>=0 # }
Run the code above in your browser using DataLab