Mini-Monopoly is defined as follows.

- The board consists of eight states numbered 1, 2, 3, 4, 5, 6, 7, 8.
*Go*is state 1*Jail*is state 3*Go to Jail*is state 7*Chance*is state 6*Chance*has 16 cards:- 1
*Go to Jail*, - 1
*Go to Go*, - 1
*Go to 4*, - 13 result in no move

- 1
- On each turn, roll a fair 4-sided die to determine how many spaces you move.

At first, simply create a transition matrix `rollTrans`

for a Markov chain with eight states and moves determined by rolls of a fair 4-sided die. Rather than typing out all of the numbers in the matrix, write a function that will do it for you, and which we can generalize later. Your function should accept two arguments: a number of states and a number of sides on the die. The function should return the transition matrix.

Investigate the steady-state distribution of your transition matrix `rollTrans`

. Do this in three different ways:

- Simulate a large number of ‘agents’ that start in any state(s) and move around probabilistically for a long time.
- Raise your matrix to a high power (using matrix multiplication) and look at the entries in any column.
- Find the eigenvector corresponding to eigenvalue 1.

Instead of modifying `rollTrans`

to account for the *Go to Jail* move, we can use matrix multiplication. The idea is simple. As the game describes, first we move by rolling a die, and if we land on state 7, then we move to jail. The move from the die roll is given by `rollTrans`

, and the *Go to Jail* move will be given by a new matrix `jailTrans`

.

The matrix `jailTrans`

is not much different from the 8x8 identity matrix. Most of the time there is no transition (\(i->i\) with probability 1). Only if we land on the special go to jail site (site 7) do we transition to jail (site 3). This means \(7->3\) with probability 1. Thus, build `jailTrans`

by first creating an identity matrix, and then modify column 7.

After you have created the `jailTrans`

matrix, multiply `jailTrans %*% rollTrans`

to obtain the new transition matrix. Note that `jailTrans`

is multiplied on the *left*.

Investigate the steady-state distribution using your favorite method.

Use the same idea as last time: Create a transition matrix, `chanceTrans`

, to represent the effect of selecting a *Chance* card and moving accordingly.

Recall that *Chance* is state 6. If you land on this state, you draw one of 16 cards. One card results in *Go to Jail*, one results in *Go to Go*, one results in *Go to 4*, and the remaining 13 result in no further move on this turn.

The matrix `chanceTrans`

should represent only these moves that result from *Chance* cards. After you have created this matrix, the final transition matrix will be the product `chanceTrans %*% jailTrans %*% rollTrans`

.

Investigate the steady-state distribution using your favorite method.

Use ggplot2 to make a bar chart that compares the three steady-state distributions.

You will need to create a data frame to store the three steady-state distributions. Suppose that you have these distributions in the vectors `rollDist`

, `rollJailDist`

, and `rollJailChanceDist`

. Then you can create the data frame like this:

```
monopolyData <- data.frame(prob=c(rollDist, rollJailDist, rollJailChanceDist),
site=rep(1:numStates, 3),
type=rep(c("Roll", "Roll+Jail", "Roll+Jail+Chance"), each=8))
```

After creating the data frame, you can make a bar chart like this:

```
ggplot(monopolyData) +
geom_bar(aes(site, prob, fill=type), stat="identity", position="dodge", width=0.75) +
scale_x_continuous(breaks=1:8) +
ggtitle("Steady-state distribution for Mini-monopoly")
```

We can see the effect of the additional rules:

- For the roll-only variant, all the sites are equally likely.
- If we add just the jail, then no one stays on state 7, and state 3 becomes the most likely. States right after 3 are more likely than states before 3.
- If we add
*Chance*, then the probability of state 6 decreases, while certain other probabilities increase.

Re-do the analysis of mini-Monopoly making the following adjustments. You only need to compute the steady-state values one way (powers or agents or eigenstuff)

- Increase the number of sites to ten or more.
- Change the roll probability— use a die with more sides, or perhaps not a fair die.
- Add more
*Chance*cards.