MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: help in generating a gaussian random variable


If what you mean is, you wish to generate a pseudorandom number from a
gaussian distribution with mean 0 and variance x, where x itself is a
pseudorandom number with a gaussian distribution with parameters (5, 10),
then do as follows:

In[1]:=
<< "Statistics`ContinuousDistributions`"

In[2]:=
distorig = NormalDistribution[0, x];

In[3]:=
dist = NormalDistribution[5, 10];

In[4]:=
Random[distorig /. x -> Random[dist]]
Out[4]=
9.148086435901357

The last input cell produces numbers with the desired properties.

Tomas Garza
Mexico City

----- Original Message -----
From: "Salman Durrani" <dsalman at itee.uq.edu.au>
To: mathgroup at smc.vnet.net
Subject: [mg35510] [mg35488] help in generating a gaussian random variable:




> Hi
>
> I need to generate a Gaussian random variable y having mean =0 and
variance
> =x.
>
> The variance x is itself a gaussian random variable having a known mean
and
> variance.
> e.g. mean of x =5;
> variance of x = 10;
>
> Can anyone suggest how to use this information to generate y ?
>
> thanks
>
> Salman
>
>
>
>



  • Prev by Date: Problems with simulating society ch4 section 4.3
  • Next by Date: RE: Expanding expressions with Dot, Times and Plus
  • Previous by thread: help in generating a gaussian random variable
  • Next by thread: Re: help in generating a gaussian random variable