# Define the transition matrix (replace with your own data)
transition_matrix <- matrix(c(
0.7, 0.3,
0.2, 0.8
), nrow = 2, byrow = TRUE)
# Initial state probabilities (replace with your own data)
initial_probabilities <- c(0.5, 0.5)
# Number of iterations for convergence
num_iterations <- 1000
# Initialize the state vector
current_state <- initial_probabilities
# Perform iterations to find the stationary distribution
for (i in 1:num_iterations) {
current_state <- transition_matrix %*% current_state
}
# Print the stationary distribution
cat("Stationary Distribution:\n")
print(current_state)
0 Comments