# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# <h6>Random Variables</h6>
# <p>
# https://www.countbayesie.com/blog/2015/2/20/random-variables-and-expectation
# </p>
# <p>
# A random variable is something the user assigns to an event. An example of an event is a dice roll. 
# A roll of a color wheel gives a yellow, green or red. 
# </p>
# <img src="randomvar1.png">
# The color wheel when spun defines an event space. From looking at the color wheel we can infer the probabilities
# of each event. 
# <p>$P(yellow)=1/2$</p>
# <p>$P(red)=1/4$</p>
# <p>$P(blue)=1/4$</p>
# <p>
# Given a set of events, Y,R,R,B,B we can convert these to a number. 
# </p>
# <p>$X(w)=2$ if yellow</p>
# <p>$X(w)=1$ if red</p>
# <p>$X(w)=0$ if blue</p>
#
# <p>The act of assignings numbers to a categorical variable creates a random variable. We capitalize random
# variables and the lower case w refers to the event as part of an event space.</p>
#
# <p>In most cases we are not able to infer the probability for the event space. In this case we use the data
# to define the event space and use the number of occurrences for each event to define the probabilities. This
# requires large amounts of data for multidimensional data and also requires us to update our probabilities
# to conform to the total probablity rule as we see new events which are a common occurrence in sparse conditions. 
# </p>

https://ocw.mit.edu/courses/mathematics/18-05-introduction-to-probability-and-statistics-spring-2014/readings/
    Wow this is so clear...


# +
https://ocw.mit.edu/courses/mathematics/18-05-introduction-to-probability-and-statistics-spring-2014/readings/MIT18_05S14_Reading3.pdf
<h6>Conditional Probabiity</h6>
Conditional probability answers the question "how does the probabiltity of an event change when we have extra or
new information?"

<p>Example1:: toss a coin 3 times, what is the probability of 3 heads? The entire event space has 8 combinations:
            {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}. All outcomes are equally likely at 1/8. </p>
<p>Suppose we are told the first toss was H, this is new information in contrast to the scenario above where
we have no information other than there is a fair coin. There is a new reduced sample space bc the first one
is H, {HHH, HHT, HTH, HTT}, so the probability is 1/4. This is called conditional probability bc we have the 
conditon of observing a H first. </p>
<p>The conditional probablity is written as </p>
$P(A|B)$
This is read as the conditional probablity of A given B or the probability of A conditioned on B or the probability
of A given B. 
<img src="condprob.png">

<p>The graphical explanation for the conditional probability is the are taken up by the area under A and B divided
by the area of B. </p>
$P(A|B) = \frac{P(A \cap B)}{P(B)}$
<p>Redoing the coin example where we want the conditional probablity of A given B, applying the above formula;
A = "3 heads", B="first toss out of 3 is H", the probability of A or P(A)=1/8, the
probability of B, P(B)=1/4. We know $P(A \cap B)=A = \frac{1}{8}$  </p>
# -

<h6>Probability Mass Distribuiton for the Discrete case</h6>

<h6>Probability Distribution function for the continuous case</h6>

StarcoderdataJupyterScriptsDedupFiltered