Group Two: The Towne Family - Again, Class Activity

From Computational Statistics Course Wiki
Revision as of 16:48, 24 February 2014 by Eleishaj (talk | contribs)
Jump to navigation Jump to search

Class Activity Todd Swinson Elad Liebman Shuqi

1. Sketch the distribution Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle p_X(x)}

Eleisha Feb 24 PDF.png

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

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Mean} = E(x) }

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\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:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Standard Deviation} = \sqrt{\text{Variance}} }

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\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} }

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{Standard Deviation} = \sqrt{\text{Variance}} = \sqrt{\frac{2}{9}}}

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

CDF = F(x)

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle F(x) = x(1-\frac{x}{4}) \text{ for } 0<x<2 \text{, 0 otherwise } }

Eleisha Feb 24 CDF.png


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: Group2 rand deviates hist.png

5. What is the approximate distribution of the sum S of N deviates drawn from Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle p_X(x)} , where N >>1? The sum of S of N deviates can be approximated by a Normal by the Central Limit Theorem

So....

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle p_S(.) \text{Normal}(\frac{2}{3}N, \frac{2}{9N} ) }

6. You sum all 28, get a p-value for the sum under the null hypothesis which is the distribution from 5 with N = 28. You are basically computing a pvalue using the distribution form 5 as the null distribution