[R] random normally distributed values within range

Matthias Kohl Matthias.Kohl at stamats.de
Tue Oct 7 05:19:34 CEST 2008


one could also use the "Truncate"-methods of package distr; cf.
http://tolstoy.newcastle.edu.au/R/e5/help/08/09/1870.html

If the situation is extreme Peter Daalgard gave some sophisticated code at
http://tolstoy.newcastle.edu.au/R/e5/help/08/09/1892.html

Best,
Matthias

Rolf Turner wrote:
>
> On 7/10/2008, at 11:54 AM, Achaz von Hardenberg wrote:
>
>> Hi all,
>> I need to create 100 normally distributed random values (X) which can
>> not exceed a specific range (i.e. 0<X<Y).
>> With rnorm I cannot specify Max and min  values among which values
>> have to stay, like in runif so does some other simple way exist to do
>> this with normally distributed random values?
>
> Presumably you want a truncated normal distribution.  Duncan Murdoch
> posted some neat code on this list, back in the end of July this year,
> to generate samples from such a distribution.
>
>
> See:
>
>     http://finzi.psych.upenn.edu/R/Rhelp02a/archive/137154.html
>
>     cheers,
>
>         Rolf Turner
>
> ######################################################################
> Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
>
> ______________________________________________
> R-help at 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.

-- 
Dr. Matthias Kohl
www.stamats.de



More information about the R-help mailing list