[R] Interval for rnorm command?

Rolf Turner r.turner at auckland.ac.nz
Sun Jun 8 05:32:56 CEST 2014


On 08/06/14 02:23, zagreus wrote:
> Hello everyone!
>
> I want to create a data vector using the "rnorm" command. Let's say /x <-
> rnorm(100, 1, 2)/. This gives me 100 values from the specific normal
> distribution. However, I want to generate a variable that has a certain
> range of values, e.g. values can't exceed the interval /[-3.7; 3.7]/. How
> can I implement such an interval?

What you are asking for amounts to drawing a sample from a *truncated* 
normal distribution.

Try

	RSiteSearch("truncated normal")

to find appropriate functions to effect this procedure.

cheers,

Rolf Turner



More information about the R-help mailing list