Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: random variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102857] Re: [mg102833] random variable
  • From: "Tony Harker" <a.harker at ucl.ac.uk>
  • Date: Sat, 29 Aug 2009 06:34:24 -0400 (EDT)
  • References: <200908280943.FAA11851@smc.vnet.net>

  The best bet is probably the rejection method. Suppose the required
distribution is p(x). We generate random numbers according to some
distribution q(x) which need not be normalised (but should be normalisable,
that is, have a finite integral over the domain of interest) with q(x)>=p(x)
for all x -- ideally q(x) should be a distribution that has the same general
shape as p(x), but in extremis we can just use a uniform distribution. This
function q(x) is called the comparison function. The one thing we need to be
able to do with q(x) is to generate samples from it (hence common choices
are the uniform and the normal distribution) Then the procedure is as
follows:
a) Select a point from the distribution q(x). This gives a value of x.
b) Select a value y from a uniform distribution between 0 and q(x).
c) If y lies below p(x), accept the value of x, otherwise reject it.
d) Repeat until the required number of x values have been accumulated.
 Obviously the closer the comparison function q(x) is to the required
distribution p(x) the more likely step (c) is to accept the point, and the
less 'wasteful' the process is.

  Tony 

]-> -----Original Message-----
]-> From: omar bdair [mailto:bdairmb at yahoo.com] 
]-> Sent: 28 August 2009 10:43
]-> To: mathgroup at smc.vnet.net
]-> Subject: [mg102833] random variable
]-> 
]-> I want to ask, how can I generate a random vaiable from 
]-> some probability density functions which are not 
]-> well-known? I mean, if we have some pdf which is not 
]-> normal, binomial, weibull, ... but the only thing I know 
]-> that it is a log-concave function, then how can I generate 
]-> a number of random variables? 
]-> 
]-> 
]-> 
]-> 



  • Prev by Date: Possible to insert an input line using $PreRead?
  • Next by Date: Problems encountered with Mathematica
  • Previous by thread: Re: random variable
  • Next by thread: Re: random variable