# What is lag time in the Markov chain?

I'm pretty new in the Markov modelling. I want to know what is lag time and how does it effect the transition matrix trajectory? I have a transition matrix shown below: $$T_{ij} = \begin{bmatrix} 0.40 & 0.56 & 0.03 & 0.01\\ 0.45 & 0.51 & 0.04 & 0.00\\ 0.25 & 0.25 & 0.25 & 0.25 \\ 0.00 & 0.00 & 0.01 & 0.99 \end{bmatrix}$$ Using the Markov Model I generated a trajectory which gives the transition probabilities between the states, but I did not use the lag time. So can anyone have any idea how can I introduce the lag time? Here is my code:

import numpy as np
import matplotlib.pyplot as plt

T = np.array([ [ 0.40, 0.56, 0.03, 0.01],
[0.45, 0.51, 0.04, 0.00],
[0.25, 0.25, 0.25, 0.25 ],
[0.00, 0.00, 0.01, 0.99 ]])

xk = np.arange(len(T))

def gen_sample(state):
return np.random.choice(xk, 1, p=T[state, :])

initial_state = 0
sample_len = 100
output = [-1 for i in range(sample_len)]
output[0] = initial_state
for i in range(1, sample_len):
output[i] = gen_sample(output[i-1])[0]
print(output)
fig, ax = plt.subplots(figsize=(12, 4))
plt.plot(np.arange(sample_len), output)
plt.xlabel("time step")
plt.ylabel("state")
plt.yticks([0, 1, 2, 3])


The following code uses the transition probabilities and generate a transition matrix. I want to introduce the lag time in this piece of code

#the following code takes a list which is generated by
# function gen_sample.
# with states labeled as successive integers starting with 0
#and returns a transition matrix, M,
#where M[i][j] is the probability of transitioning from i to j

def transition_matrix(transitions):
n = 1+ max(transitions) #number of states

M = [[0]*n for _ in range(n)]

for (i,j) in zip(transitions,transitions[1:]):
M[i][j] += 1

#now convert to probabilities:
for row in M:
s = sum(row)
if s > 0:
row[:] = [f/s for f in row]
return M

m = transition_matrix(output)
for row in m: print(' '.join('{0:.2f}'.format(x) for x in row))
$$$$
`