aphp / heemod

Markov Models for Health Economic Evaluations
https://aphp.github.io/heemod/
GNU General Public License v3.0
11 stars 1 forks source link

Errors in "starting_values works with parameters" if there is time-dependency in states #3

Closed BigweiYang closed 1 year ago

BigweiYang commented 1 year ago

when a state was time-dependency, there was a error in starting_values.

par1 <- define_parameters(
  a = .1,
  b = 1 / (model_time + 1)
)

mat1 <- define_transition(
  state_names = c("X1", "X2"),
  1-a, a,
  1-b, b
)

s1 <- define_state(
  x = 234,
  y = ifelse(state_time==1,123,0)
)

s3 <- define_state(
  x = 987,
  y = 1726

)

mod4 = define_strategy(
  transition = mat1,
  X1 = s1,
  X2 = s3,
  starting_values = define_starting_values(
    x = a * 10
  ))

ru2 <- run_model(base=mod4,
                 parameters = par1,
                 init = c(1000,0),
                 cost = x,
                 effect = y,
                 cycles = 3,
                 method = "life-table")
summary(ru2)

Error in dplyr::mutate(): ! Problem while computing x = a * 10. when I reset s1, the model is ok.

s1 <- define_state( x = 234, y = 123 )

KZARCA commented 1 year ago

Thanks for your bug report. That's fixed now.