My Math Forum  

Go Back   My Math Forum > High School Math Forum > Algebra

Algebra Pre-Algebra and Basic Algebra Math Forum

LinkBack Thread Tools Display Modes
February 9th, 2014, 06:43 AM   #1
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
ricolinka is offline  
February 9th, 2014, 11:11 AM   #2
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 .

In step b), generate similarly a random draw from the distribution 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.
Diego is offline  

  My Math Forum > High School Math Forum > Algebra

generating, homework, random, variable

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exponential Random Variable motherh Advanced Statistics 7 October 30th, 2013 11:26 AM
random variable! lawochekel Algebra 1 April 19th, 2012 12:39 PM
Probability of generating a repeat random number... jsulliva83 Algebra 0 May 6th, 2009 08:34 AM
Help! Distribution of random variable alfangio Advanced Statistics 1 March 17th, 2009 01:46 PM
Discrete random variable. adbroadband Algebra 1 January 31st, 2008 09:49 AM

Copyright © 2018 My Math Forum. All rights reserved.