My Math Forum Homework help - Generating random variable

 Algebra Pre-Algebra and Basic Algebra Math Forum

 February 9th, 2014, 07:43 AM #1 Newbie   Joined: Feb 2014 Posts: 1 Thanks: 0 Homework help - Generating random variable Hi, I have a problem on the following homework assignment: Suppose that X and Y are discrete random variables with a joint probability mass function p_XY (x, y). Procedure is the following: a. Generate X ? p_X (x). b. Accept X with probability p(y|X). c. If X is accepted, terminate and return X. Otherwise go to Step a. Show that this procedure generates a random variable X ? p_X|Y (x|y). I would've been grateful for any help. Tnx
 February 9th, 2014, 12:11 PM #2 Newbie   Joined: Feb 2014 Posts: 3 Thanks: 0 Re: Homework help - Generating random variable I am assuming that by "generate some random variable" you mean to generate random outcomes that follow that particular distribution. The idea is to generate first random outcomes from a Uniform Random Variable in (0,1) for which there are plenty libraries. For instance, in java you would do something like: double uniformOutcome; Random rand; uniformOutcome = rand.nextDouble(); The generated number is a "pseudorandom" meaning it is not really random but rather a sequence of numbers that simulate randomness based on a "seed" number. Typically this formulas use modulos. Once you've your uniform random draw you just need to use $F_{X}^{-1}(uniformOutcome)$. In step b), generate similarly a random draw from the distribution $F_{y|X}^{-1}(uniformOutcome2)$and accept if outcome is bigger than a third uniform Outcome Step c), just do as told. To prove this, looks like a consequence of bayes theorem, i.e., p(x|y) = p(x) * p(y|x) / p(y), the details I leave them to you.

 Tags generating, homework, random, variable

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post motherh Advanced Statistics 7 October 30th, 2013 12:26 PM lawochekel Algebra 1 April 19th, 2012 01:39 PM jsulliva83 Algebra 0 May 6th, 2009 09:34 AM alfangio Advanced Statistics 1 March 17th, 2009 02:46 PM adbroadband Algebra 1 January 31st, 2008 10:49 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top