Skip to content
Prev 283836 / 398498 Next

Generate data - function

On Tue, Jan 31, 2012 at 10:03:39AM -0500, Val wrote:
Hi.

The graphs leave open several questions. Are the distributions
restricted to the shown intervals? How exactly should the
densities be close to the presented curves? Is it important
that the distribution of A is skewed? In other words, is it
important that the flat part of the high densities of A is
slightly increasing? Is B bimodal?

Using mixtures of two gaussians, it is possible to achieve
the following densities.

  x <- seq(0, 3, length=1001)
  y1 <- dnorm(x, mean=0.5, sd=1)
  y2 <- dnorm(x, mean=2.5, sd=1)
  plot(x, (y1+1.05*y2)/2.05, type="l")

  x <- seq(0, 3, length=1001)
  y1 <- dnorm(x, mean=0.5, sd=0.95)
  y2 <- dnorm(x, mean=2.5, sd=0.95)
  plot(x, (y1+y2)/2, type="l")

Are these curves satisfactory?

The generation then should be done differently, using
rnorm().

Petr Savicky.