Skip to main content

Table 1 Monte Carlo sampling example

From: Complex network analysis of teaching practices

Phase

r

P(0)

x

1

–

–

0

2

0.52

P(0|0)=0.8

0

3

0.86

P(0|0)=0.8

1

4

0.67

P(0|1)=0.3

1

5

0.23

P(0|1)=0.3

0

6

0.91

P(0|0)=0.8

1

  1. Suppose P(0|0)=0.8, P(1|0)=1 − P(0|0)=0.2, P(0|1)=0.3, P(1|1)=1 − P(0|1)=0.7, and we start with x(1)=0. Then to generate a sequence using these transition probabilities, we draw 5 random numbers r = (0.52,0.86,0.67,0.23,0.91) uniformly from the interval [0,1) and allow x(t)=0 when r<P(0|0), x(t − 1)=0 and x(t)=0 when r<P(0|1), x(t − 1)=1. Since x(1)=0, to obtain x(2) we look at P(0|0). Since r(2)<P(0|0), x(2)=0. However, r(3)>P(0|0), giving x(3)=1. Iterating further, since x(3)=1, we look at P(0|1) and r(4)>P(0|1), x(4)=1. Then r(5)<P(0|1), x(5)=0. Finally, r(6)>P(0|0), and x(6)=1. The sequence we get is therefore x = (0,0,1,1,0,1).