# Segment 7

## Calculation Problems

1. Prove the result of "mechanical way". \begin{align} \Delta^2 &= < (x-a)^2 > \\ &= < x^2 -2ax + a^2 > \\ \frac{d{\Delta^2}}{da} &= 0 \\ 2 <a - x> &= 0\\ 2(a - <x>) &= 0\\ a &= <x> \end{align}

2. Thought process while solving the problem:

1. It is easier to construct a piecewise function to have a maximum at zero.
2. To ensure that the function is a probability distribution, I decided to choose the function split at 0 to 1 and 1 to $\infin$
3. In order that the $M_4$ not exist, the function should contain the $-5$ power of x in it's integral.

$p(x) = \begin{cases} 0, & \text{if } x \le 0\\ \frac34, & \text{if } 0 \le x \le 1 \\ \frac1{x^5}, & \text{if } 1 \le x \le \infin \\ \end{cases}$

\begin{align} \int_{-\infin}^{\infin}p(x) &= 1\\ <x^3> &= \frac74 \\ <x^4> &= \text{does not exist} \end{align}

3. Positives and Negatives about using Median over Mean.

Positives: Mean, due to it's sensitivities is skews the central tendency because of outliers. While median is a better estimate of the true valies. Negatives: Mean is a lot more sensitive to the data, that is, if the distribution is close to a normal distribution the mean would give the central tendency. But the median is not as efficient in a normal distribution.

## Class Activity

Group Activity with Jin, Rcardenas, Lori

1. What does a joint uniform prior on w and b look like?

Let P(X,Y) be P(w=X,b=Y), it's uniform, so the probability is the same for any X,Y.

$P = \int_0^1\int_0^{1-X} P(X,Y)dXdY = 1$

We got $P = P(X,Y)* (X-\frac{X^2}2)|_0^1 = 1 \rightarrow P(X,Y) = 2$

2.Suppose we know that w=0.4, b = 0.3, and d = 0.3. If we watch N = 10 games, what is the probability that W = 3, B = 5, and D = 2?

$P(3,5,2) = \binom{10}{3} \cdot \binom{7}{5} \cdot w^3 \cdot b^5 \cdot d^3 = 0.0353$

3. For general w, b, d, W, B, D, what is P(W, B, D | w, b, d)?

$P(W,B,D|w,b,d) = \binom{N}{W} \cdot \binom{N-W}{B} \cdot w^W \cdot b^B \cdot d^D$

4. Applying Bayes, what is P(w, b, d | W, B, D)? What is the Bayes denominator?

$P(w,b,d | W, B, D) = \frac{P(W,B,D|w,b,d) \cdot P(w,b,d)}{\int_0^1 \int_0^{1-w} P(W,B,D|w,b,d) \cdot P(w,b,d)}=\frac{w^W \cdot b^B \cdot d^D}{\frac{W! \cdot B! \cdot D!}{(W+B+D+2)!}}$

The denominator is:

$\frac{W! \cdot B! \cdot D!}{(W+B+D+2)!}$

5. Using the data from last Friday, count the outcomes of the first N games and produce a visualization of the joint posterior of the win rates for N = 0, 3, 10, 100, 1000, and 10000.

An interesting observation is the more game we count, the smaller the possible posterior probability space we will get, which means we become more confident on the probability we estimate by counting more games.

N=0

N=3

N=10

N=100

N=1000

N=10000