pierucci/heemod

Bug in the starting_values parameter of define_state in semi-markov model (when use state_time)

salmuz opened this issue · 2 comments

Bug in the starting_values parameter of define_state method in semi-markov model (when use state_time), it doesn't takes into account the formula expression (non-standard evaluation) within the starting_values parameter.

run_model(
  parameters = define_parameters(
    init_cost = 100, 
    cost_hospit = 5
  ),
  base = define_strategy(
    transition = define_transition( 
      state_names = c("life", "dead"),
       .5, .5,
        0,  1
    ),
    life = define_state( total = ifelse(state_time == 1, init_cost, 0), qaly = 0),
    dead = define_state( total = 0, qaly = 0),
    starting_values = define_starting_values(
      total = init_cost * cost_hospit 
    )
  ),
  cost = total, 
  effect = qaly, 
  init = c(
    life = 1000, 
    dead = 0
  ),
  state_time_limit = list(
    base = c( life = 1)
  )
)

Error executing code above:

base: detected use of 'state_time', expanding state: life.
Error in mutate_impl(.data, dots) : 
  Evaluation error: object 'init_cost' not found.

Which version of heemod are you using? This function has been removed in version 0.9.3.

Ok, I check it ! it's ok, thanks