ACTL2102 code
ACTL2102 code
####Question 2####
library(expm)
print(P_A_10)
print(P_B_10)
####Question 3####
####Question 4#####
# Define the stationary distribution vector
pi <- c(0.17240929, 0.17007036, 0.16776316, 0.16548727, 0.16324224, 0.16102768)
####Question 5####
# Example usage:
set.seed(1) # Setting seed for reproducibility
initial_state <- 1 # Initial state index
n = 10
m=1000
df <- as.data.frame(paths_uni_anti)
df$path_id <- 1:m
df_long <- df %>%
pivot_longer(-path_id, names_to = "time", values_to = "state") %>%
mutate(time = as.numeric(gsub("V", "", time)) - 1)
####Question 6####
####Question 7####
####Question 8####