Question 3 Nov 2024
Question 3 Nov 2024
Q. 3) Consider a discrete-time Markov chain with the state space S= {1,2,3} and the following
transition probability matrix:
0.1 0.6 0.3
[0.4 0.1 0.5]
0.2 0.3 0.5
i. Create a Markov chain in R using “markovchain” package and print the final matrix
output in R and paste in your answer. [2]
iii. Create a matrix of expected number of steps to reach all states given that it starts in
that particular state. Also, calculate the expected number of steps to return to the
same state if it starts there. [4]
iv. Suppose the process begins at State 1, calculate the transition probabilities after 2
steps, 4 steps and 6 steps. Also, Calculate the stationary distribution of the above
matrix. [4]
v. Plot a suitable graph showing the movement of probability distribution after 2 steps,
4 steps, 6 steps and finally in stationary distribution (For the purpose of this sub-part
and plotting graph only, label stationary distribution as 15 steps). Interpret the
results. [6]
vi. Simulate the Markov chain for 10,000 steps using the above transition matrix
starting from state 1. Use seed as 42. Print first 6 values of the simulated Markov
chain. [4]
vii. Calculate the number of times (nijk) such that xt = i, xt+1 = j and xt+2 = k for each
value of ijk. Print the output. i,j &k are the state spaces S= {1,2,3} respectively.
Print the output. [6]
viii. Calculate the number of times (nij) such that xt = i and xt+1 = j for each value of ij.
Print the output. [2]
ix. Perform the chi-square goodness of fit test (Triplets Test) for above hypothesis. Print
the output of chi-square test and interpret the results of chi-square test. [10]
[39 Marks]
*************************
Page 5 of 5