# Segment 8 Sanmit Narvekar

## Segment 8

#### To Calculate

1. In Segment 6 (slide 8) we used the improper prior **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 1/r}**
. Show that this is just a limiting case of a (completely proper) Lognormal prior.

2. Prove that **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 {\rm Gamma}(\alpha,\beta)}**
has a single mode at **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 (\alpha-1)/\beta}**
when **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 \alpha \ge 1}**
.

The mode of the function is the value of x at the peak. So we simply take the derivative of the pdf of a gamma distribution, set it equal to 0, and solve for 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 \frac{d}{dx} \left( \frac{\beta^\alpha}{\Gamma(\alpha)} x^{\alpha-1}e^{-\beta x}\right) = 0}**

**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 \frac{\beta^\alpha}{\Gamma(\alpha)} \left( x^{\alpha-1}e^{-\beta x} (-\beta) + e^{-\beta x}(\alpha - 1) x^{\alpha - 2} \right) = 0 }**

**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 \frac{\beta^\alpha}{\Gamma(\alpha)} (x^{\alpha-2}e^{-\beta x}) (-\beta x + (\alpha - 1)) = 0}**

Thus, one solution is at:

**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 (-\beta x + (\alpha - 1)) = 0}**

And solving for x gives:

**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 x = \frac{\alpha - 1}{\beta}}**

3. Show that the limiting case of the Student distribution as **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 \nu\rightarrow\infty}**
is the Normal distribution.

We start by taking the limit:

**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 \lim_{\nu \to \infty} \frac{\Gamma(0.5 (\nu+1))}{\Gamma(0.5 \nu)\sqrt{\nu \pi} \sigma} \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right)^{-\frac{1}{2}(\nu + 1)}}**

Split the limits over the 2 terms:

**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 = \lim_{\nu \to \infty} \frac{\Gamma(0.5 (\nu+1))}{\Gamma(0.5 \nu)\sqrt{\nu \pi} \sigma} \lim_{\nu \to \infty} \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right)^{-\frac{1}{2}(\nu + 1)}}**

For ease of exposition, we evaluate the two limits separately.

The second limit is done as follows:

**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 \lim_{\nu \to \infty} \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right)^{-\frac{1}{2}(\nu + 1)} }**

Take the **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^{\ln(X)}}**
, where X is the quantity we are evaluating. Note that this doesn't change the original function (it also sets us up nicely for turning it into a Gaussian).

**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 = \lim_{\nu \to \infty} e^{ \ln \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right)^{-\frac{1}{2}(\nu + 1)}} }**

Using properties of logarithms:

**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 = \lim_{\nu \to \infty} e^{ -\frac{1}{2}(\nu + 1) \ln \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right)} }**

Notice that if we evaluate the limit in this form, we have an indeterminate form in the exponential: **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 (-\infty) (0)}**
. One way to deal with this is to use L'Hospital's rule. First we have to get it into the right form, which is easily done by moving the first term into the denominator:

**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 = \lim_{\nu \to \infty} e^{ - \frac{ \ln \left( 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 \right) } {\frac{2}{\nu + 1} } }}**

Now we apply L'Hospital's rule by taking the derivative of the numerator and the denominator:

**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 = \lim_{\nu \to \infty} e^{ - \frac{ \left( \frac{1}{ 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 }\right) \left( \left[ \frac{t - \mu}{\sigma} \right]^2 \right) \left( \frac{1}{\nu^2} \right) } {\frac{2}{(\nu + 1)^2} } }}**

What's convenient is that we have also gotten rid of the ln! Now we bring the denominator back up (I'm going to start skipping a few steps, but hopefully you get the idea -- too much writing!).

**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 = \lim_{\nu \to \infty} e^{ - \frac{1}{2} \left( \frac{1}{ 1 + \frac{1}{\nu} \left[ \frac{t - \mu}{\sigma} \right]^2 }\right) \left( \left[ \frac{t - \mu}{\sigma} \right]^2 \right) \left( \frac{\nu^2 + 2\nu + 1}{\nu^2} \right)} }**

And now we take the limit, which will cancel out the terms in the first and last parenthesis, giving us the desired partial result. (For the last parenthesis, divide the top and bottom by nu^2, and it's easy to see that it becomes 1).

**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^{ - \frac{1}{2} \left( \frac{t - \mu}{\sigma} \right)^2 }}**

For the first limit, I used wolfram alpha (didn't know what to do with the gamma function... might look into it later):

**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 \lim_{\nu \to \infty} \frac{\Gamma(0.5 (\nu+1))}{\Gamma(0.5 \nu)\sqrt{\nu \pi} \sigma} }**

**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 = \frac{0.398942}{\sigma}}**

**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 = \frac{1}{\sqrt{2 \pi} \sigma}}**

And putting the two together gives the final answer, a normal 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 \frac{1}{\sqrt{2 \pi} \sigma} e^{ - \frac{1}{2} \left( \frac{t - \mu}{\sigma} \right)^2 }}**

#### To Think About

1. Suppose you have an algorithm that can compute a CDF, **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)}**
. How would you design an algorithm to compute its inverse (see slide 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 x(P)}**
?

One way is a binary search style method: evaluate the cdf of p(x) at some value. If we need a value that is higher, evaluate another point to the right. Otherwise, use a point on the left. At some point, you will have upper and lower bounds, and these can be used to pinpoint the value using regular binary search. This works because the cumulative distribution function is monotonically increasing.

2. The lifetime t of a radioactive nucleus (say Uranium 238) is distributed as the Exponential distribution. Do you know why? (Hint: What is the distribution of an Exponential**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 (\beta)}**
random variable *conditioned on* its being greater than some given value?)

#### Class Activity