[R] folded normal distribution in R

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 20 19:38:34 CEST 2008


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,                  ripley at stats.ox.ac.uk
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



More information about the R-help mailing list