Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. In Neverland, there are two political parties, Freedom Party (F) and Patriot

ID: 3039835 • Letter: 1

Question

1. In Neverland, there are two political parties, Freedom Party (F) and Patriot Party (P) During any given year, a Freedom Party member might switch to Patriot Party with probability 0.10, become an independent (I) with probability 0.15, or remain in Freedom Party with probability 0.75. A Patriot Party member might switch to Freedom Party with probability 0.05, become an independent with probability 0.10, or remain in Patriot Party with probability 0.85. An independent might join Freedom Party with probability 0.25, join Patriot Party with probability 0.10, or remain independent with probability 0.65.

Explanation / Answer

This is a Markov chain problem. A player/entity has a finite number of states to choose from to be or to do. The basic concept is that there is a state of being at every stage/step. This is denoted by what that member has chosen to be or do in that particular stage/step. Going towards every next stage/step, there is a probability associated to what the player/entity will end up choosing to be or do - depending on his/her/its state in the previous stage. This is denoted by the transition probability matrix.

Please find Results and R-code below!

install.packages("markovchain")
library("markovchain")

# Number of states = 3 and these are f: freedom party, p = patriot party and i: independent
States = c("f","p","i")
byRow = TRUE

# Making transition matrix - as given in the question
pMatrix = matrix(data = c(0.75,0.1,0.15,0.05,0.85,0.1,0.25,0.1,0.65), byrow = byRow, nrow = length(States), dimnames = list(States, States))

mcp = new("markovchain", states = States, byrow = byRow,
transitionMatrix = pMatrix, name = "party")

## Part d: Given initial state (2017), find state after 2 years (2019: 2 years/stages later)
# The final state matrix is found by multiplying the initial state matrix to the
# transition probability matrix raised to power equal to number of stages

initialState = c(1,0,0) # Freedom party member initially
finalState = initialState*(mcp)^2

## f p i
[1,] 0.605 0.175 0.22 ## ANSWER: Probability of Alex being a Patriot party member in 2019 = 0.175 <-- ANSWER (d)

## ANSWER (d) = 0.175

## Part e: Probability of 1st time Patriot party member in 2019 (2 years later) or 2020 (3 years later)
# TO GET THE ANSWER, WE NEED TO SUBTRACT THE PROBABILITY OF BEING A PATRIOT MEMBER IN 2018 (AND 2019, if solving for case of 2020)

## Get finalState for each year
### 2018
initialState = c(1,0,0) # Freedom party member initially
finalState2018 = initialState*(mcp)^1
# f p i
0.75 0.1 0.15 # Probability of NOT BEING PATRIOT PARTY MEMBER IN 2018 = P(f) + P(i) <-- We use these to further calculate final answer

## P(being p FIRST TIME in 2019) = 0.75*(P(p in next year given f in this year)) + 0.15*(P(p in next year given i in this year))
## P(being f in 2018 and p in 2019) = 0.75*0.1 + 0.15*0.1 = 0.09 <-- ANSWER (e i)

## ANSWER (e - i) = 0.09

## Given f in 2017,
## P(being p FIRST TIME in 2020) = P(f in 2018)*(P(f in 2019 given f in 2018 and p in 2020)) + P(i in 2018)*(P(f in 2019 given i in 2018 and p in 2020)) + P(f in 2018)*(P(i in 2019 given f in 2018 and p in 2020)) + P(i in 2018)*(P(i in 2019 given i in 2018 and p in 2020))

## P(being p FIRST TIME in 2020) = 0.75*(0.75*0.1) + 0.15*(0.25*0.1) + 0.75*(0.15*0.1) + 0.15*(0.65*0.1) = 0.081 <-- ANSWER (e ii)

## ANSWER (e - ii) = 0.081