Date: Sat, 2 Aug 1997 05:53:16 GMT Andrew James Llwellyn Cary "SAS(r) Discussion" Andrew James Llwellyn Cary Cary Consulting Services Re: Generation of truncated Normal randon variables

Hmm.

There are two slightly different solutions here depending on whether wish to truncate the normal curve at some arbitrary percentage (i.e. draw a random sample from a normal distribution where the upper 10% and lower 5% are censored) or truncate it at some arbitrary values (i.e. draw a random sample from a normal distribution with mean 0 and variance 1 where the sample is bounded by -2 and +1.5 inclusively).

In either case one has to establish the bounds of the sample and randomly sample from a normal distribution discarding elements outside the limits.

(UNTESTED CODE)

DATA _TEST_;

*SAMPLE FROM A POPULATION WITH MEAN 50, VARIANCE 10, BOUNDED BY 20 AND 85 ;

DO UNTIL (20 <= SAMPLE1 <= 85); SAMPLE1 = 50 + NORMAL(0)*10 ; END;

*SAMPLE FROM A POPULATION WITH MEAN 50, VARIANCE 10, CENSORING THE TOP 15% AND LOWER 10%;

LOWER= 50 + PROBIT(.10)*10; UPPER= 50 + PROBIT(.85)*10;

DO UNTIL (LOWER <= SAMPLE2 <= UPPER); SAMPLE2 = 50 + NORMAL(0)*10; END; RUN;

Marcio Mello <marciom@INEP.GOV.BR> wrote in article <B0000017269@phoenix.inep.gov.br>... Hi , Sas-L : I need to generate normal random variables that are truncated at right ( and at left ) . If someone knows a way of doing it , please contacte me .

Marcio Corrja de Mello marciom@inep.gov.br

----------

Back to: Top of message | Previous page | Main SAS-L page