Starting_values incorrectly calculated in the ICER calculation
Reale3 opened this issue ยท 18 comments
Hello,
I have a 'semi-absorbing' state in the model, meaning a portion of patients alive from the previous cycle remains in the same state. In addition, anoter portion of patients from the other states enters into this state in the current cycle.
E.g. C state in the transition matrix
A B C D
A 0 0.50 0.25 0.25
B 0.50 0 0.25 0.25
C 0 0 0.80 0.30
D 0 0 0 1
I'd like to add an intervention cost only to the portion that enters into this state in the current cycle, i.e., 0.25 from state A and 0.25 from state B.
Because the portion carrying forward from the previous cycle, i.e., 0.80 from state C itself, already had the intervention cost in the previous cycle. Is there a possibility to do it in heemod?
Thanks,
Hi,
Yes, it is possible, with the starting_value()
argument within define_state()
:
s3 <- define_state(
x = 987,
y = 1726,
z = 963,
starting_values = define_starting_values(
y = 10
)
That way, y is incremented only when entering the s3 state.
Thank you, @KZARCA
I am trying it, however, no way to check the costs per state per cycle. Unless I perform same exercise in the excel and tally the final results. (which has brought me to some other questions). Nevertheless, thank you very much.
Hello,
I did define starting values for partial cost in the state. While it perfectly results in cost of that intervention in each cycle (received by get_values), it does not enter into total cost from which the ICER is calculated.
Wondering if something I need to change (newbie in this package). Here goes the transition matrix again and how I defined the states:
A B C D
A 0 0.50 0.25 0.25
B 0.50 0 0.25 0.25
C 0 0 0.80 0.20
D 0 0 0 1
A <-define_state(
cost_x=130,
cost_y=150,
cost_z=0,
total.cost=(cost_x+cost_y+cost_z)
)
B <-define_state(...)
C <- define_state(
cost_x=130,
cost_y=150,
cost_z=0,
starting_values=define_starting_values(cost_z=500),
total.cost=(cost_x+cost_y+cost_z)
)
model <- run.model(strategy, arm1, arm2, parameters, cycles, cost=total.cost, effect, init=c(100,0,0,0))
Hi,
would you propose a pull request?
Here is the summary of one of my models, if helps, where you can see the "total.cost" does not include "Cost_startingvalues" that was added in one state as starting_values. And neither in the calculation of cost difference betn. two strategies. Thank you.
Cost_A | Cost_B | Cost_startingvalues | total.cost | |
---|---|---|---|---|
Strategy1 | 679,905 | 924,297 | 290,524 | 1,604,202 |
Strategy2 | 616,111 | 266,054 | 471,509 | 882,164 |
Differences: | ||||
---|---|---|---|---|
Cost Diff. | Effect Diff. | ICER | Ref. | |
Strategy1 | 7220.378 | 1.256319 | 5747.251 | Strategy2 |
For now, you can only use starting values that way:
A <- define_state(
cost_x=130,
cost_y=150,
cost_z=0,
total_cost = cost_x+cost_y+cost_z
starting_values=define_starting_values(
total_cost=500
)
You first need to use the development version (devtools::install_github("pierucci/heemod")
)
For now, you can only use starting values that way:
A <- define_state( cost_x=130, cost_y=150, cost_z=0, total_cost = cost_x+cost_y+cost_z starting_values=define_starting_values( total_cost=500 )
It is not working still. It seems it's assigning some part of starting values to the very first cycle (not sure in which proportion), even if the first cycle have 0 transition for the state with starting values. Cannot find the exact bug.
You first need to use the development version (
devtools::install_github("pierucci/heemod")
)
Hope it's addressed to another developer from the mailing list! It will take a tremendous amount of time for me if I have to pull request as I am not a developer. Thanks,
Don't worry, you just have to write devtools::install_github("pierucci/heemod") in your R console.
Don't worry, you just have to write devtools::install_github("pierucci/heemod") in your R console.
Now, seems that it counts starting_values of the cost for new entrant in that stage in the current cycle; however, it does not add the stable cost for the stage. For e.g., in the above example, costs are calculated for the new entering numbers (in current cycle) only 500. But it does not assign them the stable cost, i.e. 130+150.
Any help will be super great. I am, at the moment, forced to use only excel even if I very much would like to use this package, especially it will be helpful for further sensitivity analysis.
It would be very helpful if you could write a working minimal reproducible example with the result you would expect, so that I can easily check what is going on.
It would be very helpful if you could write a working minimal reproducible example with the result you would expect, so that I can easily check what is going on.
Is it possible that I can send you the code to your mail instead of sharing it here? Otherwise I will create some dummy code as I cannot share the full code in open forum right now.
Please, create a dummy code, the simplest as possible, it will be much easier for me.
dummycode.txt
Here is the .txt file for dummy code. As you see, costs of "treatment" arm in the values2 table, please compare them with the below values that I have calculated in the excel:
Cycle | I1 | S1 | R | S2 | C | A | D | Total |
---|---|---|---|---|---|---|---|---|
0 | 60,000.00 | - | - | - | - | - | - | 60,000.00 |
1 | 0 | 7,072.85 | 5,735.51 | - | - | 4,412.45 | - | 17,220.81 |
2 | 0 | 5,002.52 | 4,056.64 | 676.11 | 91.38 | 3,865.94 | - | 13,692.58 |
3 | 0 | 3,538.20 | 2,869.20 | 956.40 | 202.63 | 3,364.41 | - | 10,930.84 |
4 | 0 | 2,502.52 | 2,029.34 | 1,014.67 | 299.82 | 2,911.19 | - | 8,757.53 |
5 | 0 | 1,769.99 | 1,435.32 | 956.88 | 370.04 | 2,506.55 | - | 7,038.79 |
Total | 117,640.55 |
Stage A in the code is semi-absorbing stage where newly entering counts have some first time cost that do not apply to the carried over counts from the same stage of the previous cycle.
I have already checked the counts for all the stages and cycles and they are alright. Same for the utility values.
Please note that I am using "end" method so it's easier for me to cross check with my excel calculations.
Only a problem with the cost because I am adding a starting cost (1000) to only new entering counts in stage A.
For now, the cost values that I am receiving are closer to the cost values if I model only costs of starting values (i.e.1000) for newly entering counts in stage A. However, newly entrant counts should also have in addition stable/originally defined state costs (i.e.100). Thus, total cost for newly entering count in stage A should be 1000+100.
Please let me know if not clear. Thank you very much.
I think I fixed the issue, it was due to a conflict between "end" method and starting values. You can install the new development version of heemod :
devtools::install_github("pierucci/heemod")
Thanks a lot, @KZARCA !
I've now tried it in different strategies and it works alright for calculating starting values of new entering counts in the cycle. Hopefully, only will come back with other feedback/questions.
Meanwhile, if I forgot to say: thanks for the package as well!
You're very welcome !