# Travis: Segment 8

#### To Calculate

**1. In Segment 6 (slide 8) we used the improper prior <math>1/r</math>. Show that this is just a limiting case of a (completely proper) Lognormal prior.**

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

<math> p(x) = \frac{\beta^\alpha}{\Gamma (\alpha)}x^{\alpha-1}e^{-\beta x} </math>

<math> \frac{d (p(x))}{dx} = 0 = \frac{\beta^\alpha}{\Gamma (\alpha)}(\alpha -1)x^{\alpha-2}e^{-\beta x} - \frac{\beta^\alpha}{\Gamma (\alpha)}x^{\alpha-1} (-\beta) e^{-\beta x} = \frac{\beta^\alpha}{\Gamma (\alpha)}x^{\alpha-2}e^{-\beta x} \bigg[ (\alpha -1) - \beta x \bigg] = 0</math>

<math> \therefore x = \frac{\alpha -1}{\beta} </math> for an optimal point with <math> \alpha \ge 1 </math>.

**3. Show that the limiting case of the Student distribution as <math>\nu\rightarrow\infty</math> is the Normal distribution.**

#### To Think About

**1. Suppose you have an algorithm that can compute a CDF, <math>P(x)</math>. How would you design an algorithm to compute its inverse (see slide 9) <math>x(P)</math>?**

**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<math>(\beta)</math> random variable conditioned on its being greater than some given value?)**

#### Class Activity

Here's the code group 1 did for class, but we can't figure out what's wrong with our code. Help please :-) On the first iteration, the performance index is 2025.86. but then it converges to 918 which is way off.

clc clear all close all X0 = [2,1.2,5]; % mu, sigma, nu ops = optimset('Display','iter'); [x,fval,exitflag,output] = fminsearch(@opt, X0,ops)

function [prob] = opt(X) m = load('stacks.txt'); newm = (m-(X(1)))./X(2); T = tpdf(newm,X(3)); prob = sum(log(T))*-1; end