Markov Chain question, thanks for your help! ->>>>> On a recent exam, 60% of the
ID: 3821356 • Letter: M
Question
Markov Chain question, thanks for your help! ->>>>> On a recent exam, 60% of the students received an A, 30% received a B and the remainder received a Need Improvement. On subsequent tests, of those who received an A, 10% received a B and 5% a C. Of those who received a B, 2% received an A and 5% a C. Of those who received a C, 6% received a B.
If the class has 50 students:
a.) Create a Markov Chain function
b.) Determine X2, X3 and X4 . Interpret X4
c.) Determine whether there exist a steady state matrix and determine it if it exists.
d.) Determine the number of students of the Steady State Matrix and interpret what the values mean.
Explanation / Answer
library(expm)
library(markovchain)
library(diagram)
library(pracma)
stateNames <- c("XX","XXXXXXX","XXXXX")
Oz <- matrix(c(25,.25,.5),
nrow=3, byrow=TRUE)
row.names(Oz) <- stateNames; colnames(Oz) <- stateNames
Oz
plotmat(Oz,pos = c(1,2),
lwd = 1, box.lwd = 2,
cex.txt = 0.8,
box.size = 0.1,
box.type = "circle",
box.prop = 0.5,
box.col = "light yellow",
arr.length=.1,
arr.width=.1,
self.cex = .4,
self.shifty = -.01,
self.shiftx = .13,
main = "")
Oz3 <- Oz %^% 3
round(Oz3,3)
u <- c(1/3, 1/3, 1/3)
round(u %*% Oz3,3)
#0.401 0.198 0.401
p <- c(.5,0,.5)
dw <- c(1,rep(0,4),p,0,0,0,p,0,0,0,p,rep(0,4),1)
DW <- matrix(dw,5,5,byrow=TRUE)
DWmc <-new("markovchain",
transitionMatrix = DW,
states = c("0","1","2","3","4"),
name = "Drunkard's Walk")
DWmc
transientStates(DWmc)
absorbingStates(DWmc)