MathGroup Archive 2009

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

Search the Archive

Re: random variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103055] Re: [mg102833] random variable
  • From: "Tony Harker" <a.harker at ucl.ac.uk>
  • Date: Sat, 5 Sep 2009 05:38:22 -0400 (EDT)

 I have attached a sample notebook to this for omar. If anybody else would
like a copy, it is available from
http://www.cmmp.ucl.ac.uk/~ahh/teaching/Mathematica/RejectionMethod.nb. 

  Tony Harker

]-> -----Original Message-----
]-> From: omar bdair [mailto:bdairmb at yahoo.com] 
]-> Sent: 04 September 2009 15:42
]-> To: Tony Harker; mathgroup at smc.vnet.net
]-> Subject: Re: [mg102833] random variable
]-> 
]-> Hi,
]-> I think the rejection method is the best. But the steps 
]-> mentioned in the algorithm below are hard to perform 
]-> because generating random sample from g(x) is in fact our 
]-> problem. Please send me an example which illustrates what 
]-> is mentioned. And if any body can help me in performing the 
]-> 5 steps as a sketch mathematica program, please send me this sketch.
]-> Another question:
]-> Is it possible to call every generated random variable by 
]-> h[i], say, i=1,2,...,n. This step is important because I 
]-> want to use these random variables in the future computations. 
]->          
]-> Omar Bdair
]-> 
]-> 
]-> ________________________________
]-> 
]-> From: Tony Harker <a.harker at ucl.ac.uk>
]-> To: omar bdair <bdairmb at yahoo.com>; mathgroup at smc.vnet.net
]-> Sent: Friday, August 28, 2009 2:51:07 PM
]-> Subject: RE: [mg102833] random variable
]-> 
]-> 
]->   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: Re: Editing named style sheet?
  • Next by Date: Re: how to solve the integer equation Abs[3^x-2^y]=1
  • Previous by thread: Re: random variable
  • Next by thread: Re: random variable