Today’s Agenda

  • Continuous Distribution
  • Uniform Distribution

Continuous Distribution

  • When data is numeric continuous, we can often make the bins of a histogram extremely small and still have a very readable graph

eg.

  • eg. A student has an assigned text book for a course. How much a random student in the course spends on the text book is a random variable, \(X\).

  • random variables are usually denoted with capitals \(X\),\(Y\),\(Z\)

  • The book store assumes that students will either: not buy a book, buy the book used, or buy it brand new. The possible outcomes are usually denoted with lower case letters.

  • Revenue for the book store is \(x_1 = 0\), \(x_2 = 137\), \(x_3 = 170\) for the three possbilities and the book store believes they each occur with probability \(.20\), \(.55\), and \(.25\) respectively. In probability notation:

\[P(X=0) = .20, \ P(X=137) = .55, \ P(X=170) = .25\]

Since there are only three possible outcomes, this is called a discrete probability distribution

probs <- c(.2,.55,.25)
book_prices <- c(0,137,170)
barplot(probs~book_prices,ylim=c(0,1))

Another discrete probability distribution is that of rolling a die:

die_probs <- c(1/6,1/6,1/6,1/6,1/6,1/6)
die_rolls <- c(1,2,3,4,5,6)
barplot(die_probs~die_rolls, ylim=c(0,1))

  • all probabilites in a probability distribution must be between 0 and 1.
  • the sum of all the probabilites must equal 1.
  • discrete probability distributions only have finitely many possible outcomes.

Expected Value

The expected value of a random variable is:

\[E(X) = x_1 \times P(X=x_1) + \dots + x_k \times P(X=x_k) = \sum_{i=1}^k x_i P(X = x_i)\]

and the standard deviation of the expected value of the random variable is

\[\sqrt{\sum_{i=1}^k (x_i-E(X))^2 P(X = x_i)}\]

If all the probabilities are the same, then \[E(X) = x_1 \times \frac{1}{k} + \dots + \frac{1}{k} \times P(X=x_k) = \frac{\sum_{i=1}^k x_i}{k} = \bar{x}\]

this is just the mean.

eg. The expected price of a text book is

# This finds each book price times each probability
probs*book_prices
## [1]  0.00 75.35 42.50
# the expected value is the sum
sum(probs*book_prices)
## [1] 117.85
# the expected cost of the book is $117.85
# find the standard deviation of the price
sqrt(sum((117.85-book_prices)^2*probs))
## [1] 60.49238

Unifrom Distribution

  • When all probabilities are equally likely the distribution is called the uniform distribution.

  • The expected value of a random variable with a uniform probability distribution is the mean of the possibilities