Assignment 1: Julia and Turing

Students
Name Id
Ploni Almoni 123489589
John Smith 923352302

Summary

In this assignment we learn to use Julia and Turing.jl. The assignment is based on the class material:

The assignment consists of two problems. For each problem, you must present a solution

  1. In pure Julia.
  2. Using Turing.

In addition to computations, solutions must include graphical visualization and numerical characterization of the posterior.

Problem 1: The garden of forking data

A black box contains four marbles. Each marble is either blue or white. In general, blue marbles are twice as frequent as white ones. One can only remove one marble from the box. A marble removed from the box can be put back. The following procedure is repeated three times:

  1. Shake the box to mix the marbles.
  2. Remove one marble and record the color.
  3. Put the marble back into the box.

Three marbles where observed: one blue and two whites.


Find the probability distribution of color combinations of the four marbles in the box.

1.1 Solution in pure Julia

Implement and explain your solution. Use as many code and markdown cells as you need.

1.2 Solution using Turing

Implement and explain your solution. Use as many code and markdown cells as you need.

2. Tossing the globe

A globe (a model of the Earth) has areas covered by water (W) colored in blue, and exposed land areas (L) in shades of green or brown. One tosses the globe in the air 10 times and touches a random area, resulting in the following sequence of observations: WLWWWLWLWL.


What portion of the Earth is covered by water?

2.1 Solution in pure Julia

Implement and explain your solution. Use as many code and markdown cells as you need.

2.2 Solution using Turing

Implement and explain your solution. Use as many code and markdown cells as you need.