Problem 0

Problem 0a

studio5_problem_0a()

You should list all the hypotheses for the type of die being rolled

Problem 0b

studio5_problem_0a()

You should list all possible outcomes for one roll of the die.

Problem 0c

studio5_problem_0c()
## -----
## 0c. Print likelihood table for one roll.
## The rows in the table are hypotheses; the columns are outcomes. The table is printed out below.
##          1      2      3      4      5      6      7      8      9     10
## D4  0.2500 0.2500 0.2500 0.2500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## D6  0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 0.0000 0.0000 0.0000 0.0000
## D8  0.1250 0.1250 0.1250 0.1250 0.1250 0.1250 0.1250 0.1250 0.0000 0.0000
## D12 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833 0.0833
## D20 0.0500 0.0500 0.0500 0.0500 0.0500 0.0500 0.0500 0.0500 0.0500 0.0500
##         11     12   13   14   15   16   17   18   19   20
## D4  0.0000 0.0000 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## D6  0.0000 0.0000 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## D8  0.0000 0.0000 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## D12 0.0833 0.0833 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## D20 0.0500 0.0500 0.05 0.05 0.05 0.05 0.05 0.05 0.05 0.05

Problem 1

Problem 1a

studio5_problem_1a()
## 
## ----------------------------------
## Problem 1a. Run example 2.
## Read the code and looked at the plots.

Problem 1b

prior = c(0.2, 0.2, 0.2, 0.2, 0.2)
studio5_problem_1b(prior, 8, TRUE)
## -----
## 1b. Updates, bar plots, stacked bar plot.
## The initial prior is
## [1] 0.2 0.2 0.2 0.2 0.2
## nrolls = 8

## The final posterior is
##      D4 D6     D8     D12       D20
## [1,]  0  0 0.9618 0.03753 0.0006304
## The true type of the chosen die is 8 sided
## See plots

The following can be used to answer problem 1c.

prior = c(0.2, 0.2, 0.2, 0.2, 0.2)
studio5_problem_1b(prior, 20, FALSE)
## -----
## 1b. Updates, bar plots, stacked bar plot.
## The initial prior is
## [1] 0.2 0.2 0.2 0.2 0.2
## nrolls = 20

## The final posterior is
##      D4 D6     D8       D12       D20
## [1,]  0  0 0.9997 0.0003006 1.099e-08
## The true type of the chosen die is 8 sided
## See plots
prior = c(0.001, 0.001, 0.001, 0.001, 0.996)
studio5_problem_1b(prior, 20, FALSE)
## -----
## 1b. Updates, bar plots, stacked bar plot.
## The initial prior is
## [1] 0.001 0.001 0.001 0.001 0.996
## nrolls = 20

## The final posterior is
##      D4 D6     D8       D12       D20
## [1,]  0  0 0.9997 0.0003006 1.095e-05
## The true type of the chosen die is 8 sided
## See plots

Problem 1c

studio5_problem_1c()
## -----
## 1c. Compare and contrast.
## You need to write your own compare and contrast statement here.

Problem 1d

studio5_problem_1d()
## -----
## 1d. Too certain a prior.
## Running studio5_problem_1b
## -----
## 1b. Updates, bar plots, stacked bar plot.
## The initial prior is
## [1] 0.25 0.25 0.00 0.25 0.25
## nrolls = 20

## The final posterior is
##      D4 D6 D8 D12       D20
## [1,]  0  0  0   1 3.656e-05
## The true type of the chosen die is 8 sided
## See plots
## With a prior probability of 0, no amount of data will convince us that the chosen die has 8 sides. It chooses the next most probable die (D12) given the data

Problem 2

Problem 2a

studio5_problem_2a()
## 
## ----------------------------------
## OPTIONAL 2a. List hypotheses, outcomes, make likelihood table.
## The hypotheses are the same as before: we chose a 4, 6, 8, 12, or 20-sided die
## The possible outcomes of each roll are 0 or 1
## The likelihood table is 5 rows for the hypotheses and 2 columns for the possible outcomes of 1 and 0.
## Censored likelihood table
##         0      1
## D4  0.750 0.2500
## D6  0.833 0.1667
## D8  0.875 0.1250
## D12 0.917 0.0833
## D20 0.950 0.0500

Problem 2b is OPTIONAL

prior=c(.2,.2,.2,.2,.2)
studio5_problem_2b(prior, 30)
## -----
## OPTIONAL 2b: Censored data.

## The final posterior is
##          D4     D6    D8   D12     D20
## [1,] 0.1981 0.3634 0.292 0.123 0.02337
## The true type of the chosen die is 4 sided
## See plots
studio5_problem_2b(prior, 200)
## -----
## OPTIONAL 2b: Censored data.

## The final posterior is
##             D4        D6       D8    D12    D20
## [1,] 2.564e-13 2.198e-06 0.001314 0.1571 0.8416
## The true type of the chosen die is 20 sided
## See plots

MIT OpenCourseWare

https://ocw.mit.edu

18.05 Introduction to Probability and Statistics

Spring 2022

Authors: Jeremy Orloff and Jennifer French

For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms