# Eleisha's Segment 17: The Towne Family - Again

Class Activity

1. Sketch the distribution $\displaystyle p_X(x)$

2. What is the distribution's mean and standard deviation? Mean:

$\displaystyle \text{Mean} = E(x)$

$\displaystyle E(x) = \int_0^2 xp(x) dx = \int_0^2 x\left(1 - \frac{x}{2}\right) dx = \frac{x^2}{2} - \frac{x^3}{6} \Big|_0^2 = \frac{2}{3}$

Standard Deviation:

$\displaystyle \text{Standard Deviation} = \sqrt{\text{Variance}}$

$\displaystyle \text{Variance} = \int_0^2 x^2p(x) dx - [E(x)]^2 = \left(\frac{x^3}{3} - \frac{x^4}{8}\right)\Big|_0^2 - [E(x)]^2 = \frac{6}{9} -\frac{4}{9} = \frac{2}{9}$

$\displaystyle \text{Standard Deviation} = \sqrt{\text{Variance}} = \sqrt{\frac{2}{9}}$

3. What is its cumulative distribution function (CDF)?

CDF = F(x)

$\displaystyle F(x) = x(1-\frac{x}{4}) \text{ for } 0

4. Write code or pseudocode for drawing random deviates from the distribution. (You may assume that you have a random generator for unifor (0,1).)

Code:


def getRandomDeviate():
p = random.random()
return -2*sqrt(1-p) + 2

def testRandomDeviateGenerator():
curset = []
for i in range(100000):
curset.append(getRandomDeviate())
figure()
h = hist(curset, 1000)
title('histogram of 100000 random deviates sampled for P_X(x)')


Graph of random deviates: File:Example.jpg

5. What is the approximate distribution of the sum S of N deviates drawn from $\displaystyle p_X(x)$ , where N >>1?