Displaying 3 results from an estimated 3 matches for "_truncated_".
2008 Apr 01
1
set the lower bound of normal distribution to 0 ?
...gative, so if using rnorm I would get some negative values. Is
> there any options to determine the lower bound of normal distribution to
> be 0 or can I simulate the samples in different ways to avoid the
> negative values?
Well, that would not be a normal distribution.
If you want a _truncated_ normal distribution it is very easy by
inversion. E.g.
trunc_rnorm <- function(n, mean = 0, sd = 1, lb = 0)
{
lb <- pnorm(lb, mean, sd)
qnorm(runif(n, lb, 1), mean, sd)
}
but I suggest you may rather want samples from a lognormal.
>
>
> > dat
> id x y
> 75 101 0.134 0.19...
2008 Jul 24
2
simple random number generation
useR's,
I want to randomly generate 500 numbers from the standard normal
distribution, i.e. N(0,1), but I only want them to be generated in the range
-1.5 to 1.5. Does anyone have a simple way to do this?
Thanks,
dxc13
--
View this message in context: http://www.nabble.com/simple-random-number-generation-tp18642611p18642611.html
Sent from the R help mailing list archive at Nabble.com.
2008 Mar 27
2
options in 'rnorm' to set the lower bound of normal distribution to 0 ?
Dear list,
I have a dataset containing values obtained from two different instruments (x and y).
I want to generate 5 samples from normal distribution for each instrument based on
their means and standard deviations. The problem is values from both instruments are
non-negative, so if using rnorm I would get some negative values. Is there any options
to determine the lower bound of normal