# \donttest{
# Create a Directed Acyclic Graph (DAG) structure for item relationships
# Each row represents a directed edge from one item to another
DAG <-
matrix(
c(
"Item01", "Item02", # Item01 influences Item02
"Item02", "Item03", # Item02 influences Item03
"Item02", "Item04", # Item02 influences Item04
"Item03", "Item05", # Item03 influences Item05
"Item04", "Item05" # Item04 influences Item05
),
ncol = 2, byrow = TRUE
)
# Convert the DAG matrix to an igraph object for network analysis
g <- igraph::graph_from_data_frame(DAG)
g
# Create adjacency matrix from the graph
# Shows direct connections between items (1 for connection, 0 for no connection)
adj_mat <- as.matrix(igraph::as_adjacency_matrix(g))
print(adj_mat)
# Fit Bayesian Network Model using the specified adjacency matrix
# Analyzes probabilistic relationships between items based on the graph structure
result.BNM <- BNM(J5S10, adj_matrix = adj_mat)
result.BNM
# }
Run the code above in your browser using DataLab