Reputation: 1
I am trying to build my first economic model in R and I get this error but cannot seem to figure it out. This is my first ever question here and first ever attempt to build something in R. The transition probabilities are fake.
# Define health states in the model
states <- c("SNDnoAFwIPG", "scAF", "cAF", "eStroke",
"WHFh", "minorB", "majorB", "death")
# ---------- Standard Pacemaker Model ----------
# Transition probabilities for standard pacemaker (replace with your actual data)
std_prob <- matrix(c(
0.75, 0.24, 0, 0, 0, 0, 0, 0.01, # From SNDnoAFwIPG
0, 0.66, 0.2, 0.03, 0.02, 0.05, 0.01, 0.03, # From scAF
0, 0, 0.7, 0.05, 0.2, 0.01, 0.01, 0.03, # From cAF
0, 0.9, 0.05,0, 0, 0, 0, 0.05, # From eStroke
0, 0.9, 0, 0, 0, 0, 0, 0.1, # From WHFh
0, 1, 0, 0, 0, 0, 0, 0, # From minorB
0, 0.99, 0, 0, 0, 0, 0, 0.01, # From majorB
0, 0, 0, 0, 0, 0, 0, 1 # From death
), nrow = 8, byrow = TRUE)
# Define the standard pacemaker transition matrix
std_matrix <- define_transition(state_names = states, std_prob)
However, it returns this error:
Error in define_transition_(.dots = .dots, state_names = state_names) : Length of 'state_names' (8) and size of matrix (1 x 1) differ.
I tried AI solutions and reading the manual but I still can't figure out why this is wrong.
Upvotes: 0
Views: 48