Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: help in generating a gaussian random variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35638] Re: help in generating a gaussian random variable
  • From: "Christos Argyropoulos" <argchris at otenet.gr>
  • Date: Wed, 24 Jul 2002 02:05:57 -0400 (EDT)
  • References: <ah24b6$r2l$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The following should do the trick :

Needs["Statistics`ContinuousDistributions`"];
Needs["Graphics`Graphics`"];
NormalDeviate[y_, mx_, vx_, n_] :=
Module[{t}, t = Abs /@ RandomArray[NormalDistribution[mx, Sqrt[vx]], n];
Table[Random[NormalDistribution[y, Sqrt[t[[i]]]]], {i, 1, n}]]

Histogram[NormalDeviate[0, 50, 50, 10000]]

Explation :

1) Load the continuous Distrbutions and graphics modules

2) Function NormalDeviate returns a list of n random numbers ~
N(y,N(mx,vx) )

3) Histogram plots everything
"Salman Durrani" <dsalman at itee.uq.edu.au> wrote in message
news:ah24b6$r2l$1 at smc.vnet.net...
> 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: Re: elementwise vector scalar subtraction
  • Next by Date: Re: elementwise vector scalar subtraction
  • Previous by thread: Re: help in generating a gaussian random variable
  • Next by thread: Characteristic function of Caucy distrbution