It's trivial to do. In particular abs(rnorm(...)) will give you the random number generator.

The term 'folded normal distribution' is normally only used for mean=0, when you just double the density, but the general result is

ifelse(x > 0, 1, 0) * (dnorm(x, ...) + dnorm(-x, ...))


On Mon, 20 Oct 2008, Andreas Wittmann wrote:

Dear R useRs,

i wanted to ask if the folded normal destribution (Y = abs(X) with X normal distributed) with density and random number generator is implemented in R or in any R-related package so far? Maybe i can use the non-central chi-square distribution and rchisq(n, df=1, ncp>0) here?

Thanks and best regards

Andreas

--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to