Comments (9)
Hi,
I cannot reproduce your error as I do not have your full code. If you need help, please send it to me.
Best,
Kevin
from heemod.
Hi,
I cannot reproduce your error as I do not have your full code. If you need help, please send it to me.
Best,
Kevin
Hi Kevin, thanks for the help, the full code is here
dr=0.03
#Transition
vacc=define_transition(
.97995,.00005,0,.02,
0,.97,.01,.02,
0,0,.9,.1,
0,0,0,1)
no.vacc=define_transition(
.9798,.0002,0,.02,
0,.97,.01,.02,
0,0,.9,.1,
0,0,0,1)
#Healthy
state_A <- define_state(
cost_health = discount(15, dr),
cost_drugs = discount(dispatch_strategy(
vaccination = ifelse(model_time == 1, 4, 0),
no_vaccination = 0), dr),
cost_total = cost_health + cost_drugs,
QALY = discount(1,dr)
)
#chronic HBV
state_B <- define_state(
cost_health = discount(15, dr),
cost_drugs = discount(dispatch_strategy(
vaccination = ifelse(model_time == 1, 4, 0),
no_vaccination = cost_no_vaccination), dr),
cost_total = cost_health + cost_drugs,
QALY = discount(1,dr)
)
#compensated cirrhosis
state_C <- define_state(
cost_health = discount(3500, dr),
cost_drugs = discount(dispatch_strategy(
vaccination = ifelse(model_time == 1, 4, 0),
no_vaccination = cost_no_vaccination), dr),
cost_total = cost_health + cost_drugs,
QALY = discount(0.75,dr)
)
#dead
state_D <- define_state(
cost_health = 0,
cost_drugs = 0,
cost_total = 0,
QALY = 0
)
#defining strategies
strat_vacc <- define_strategy(
transition = vacc,
state_A,
state_B,
state_C,
state_D
)
#defining strategies
strat_no_vacc <- define_strategy(
transition = no.vacc,
state_A,
state_B,
state_C,
state_D
)
#running the model
res_mod <- run_model(
vaccination = strat_vacc,
no_vaccination = strat_no_vacc,
cycles = 80,
cost = cost_total,
effect = QALY
);summary(res_mod)
from heemod.
It's not a bug, heemod uses a first-cycle correction named "life-table" by default. You can read more on https://journals.sagepub.com/doi/10.1177/0272989X09340585
If you want the transition to occur at the beginning of the cycle, you can choose method = "beginning".
Best
from heemod.
It's not a bug, heemod uses a first-cycle correction named "life-table" by default. You can read more on https://journals.sagepub.com/doi/10.1177/0272989X09340585
If you want the transition to occur at the beginning of the cycle, you can choose method = "beginning".
Best
'beginning' and 'end' may be inversed in heemod. Per the article 'beginning' should yield an overestimate and 'end' should yield an underestimate.
This is not reflected in the model.
Counting method: 'beginning'.
Values:
cost_health cost_drugs cost_total QALY
vaccination 301399.5 3920 305319.5 19809.24
no_vaccination 314056.4 0 314056.4 19803.60
Counting method: 'end'.
Values:
cost_health cost_drugs cost_total QALY
vaccination 307320.9 4000 311320.9 20213.62
no_vaccination 319550.0 0 319550.0 20208.21
from heemod.
OK thanks for your input, I will change it in the next heemod version.
Best
from heemod.
OK thanks for your input, I will change it in the next heemod version.
Best
Thank you.
from heemod.
@KZARCA, I am facing another issue with the run_dsa function. It works well when I define only 1 sensitivity analyses to be done (i.e., cost_vacc, discount_rate [dr]); however, when I define multipe, I get the following error:
Running DSA on strategy 'vaccination'...
Error: Can't subset columns that don't exist.
x Columns care_cirrohosis
, dr
, and rr
don't exist.
Code is below:
library(heemod)
library(tidyverse)
dr=0.03
cost_vacc=4
care_cirrohosis=3500
rr=0.25
#Transition
vacc=define_transition(
C,0.0002*rr,0,.02,
0,.97,.01,.02,
0,0,.9,.1,
0,0,0,1)
no.vacc=define_transition(
.9798,.0002,0,.02,
0,.97,.01,.02,
0,0,.9,.1,
0,0,0,1)
#Healthy
state_A <- define_state(
cost_health = discount(15, dr),
cost_drugs = dispatch_strategy(
vaccination = ifelse(model_time == 1, cost_vacc, 0),
no_vaccination = 0),
cost_total = cost_health + cost_drugs,
QALY = discount(1,dr)
)
#chronic HBV
state_B <- define_state(
cost_health = discount(15, dr),
cost_drugs = dispatch_strategy(
vaccination = ifelse(model_time == 1, cost_vacc, 0),
no_vaccination = 0),
cost_total = cost_health + cost_drugs,
QALY = discount(1,dr)
)
#compensated cirrhosis
state_C <- define_state(
cost_health = discount(care_cirrohosis, dr),
cost_drugs = dispatch_strategy(
vaccination = ifelse(model_time == 1, cost_vacc, 0),
no_vaccination = 0),
cost_total = cost_health + cost_drugs,
QALY = discount(0.75,dr)
)
#dead
state_D <- define_state(
cost_health = 0,
cost_drugs = 0,
cost_total = 0,
QALY = 0
)
#defining strategies
strat_vacc <- define_strategy(
transition = vacc,
state_A,
state_B,
state_C,
state_D
)
#defining strategies
strat_no_vacc <- define_strategy(
transition = no.vacc,
state_A,
state_B,
state_C,
state_D
)
#running the model
res_mod <- run_model(
vaccination = strat_vacc,
no_vaccination = strat_no_vacc,
cycles = 80,
init=c(1000000,0,0,0),
cost = cost_total,
effect = QALY,
method='end'
);summary(res_mod)
##plot
plot(res_mod, type = "counts", panel = "by_strategy") +
xlab("Time") +
theme_bw() +
scale_color_brewer(
name = "State",
palette = "Set1"
)
##sensitivity analyses and tornado plot
ds=define_dsa(
cost_vacc, 2, 30,
care_cirrohosis,1000,5000,
dr, 0.015, 0.06,
rr, 0.3,0.5
)
print(ds)
x=run_dsa(res_mod,ds)
plot(x,type='difference',result='icer')
`
```
from heemod.
Hi, all your variables should be encapsulated within the function define_parameters
params <- define_parameters(
dr=0.03,
cost_vacc=4,
care_cirrohosis=3500,
rr=0.25
)
from heemod.
Hi There. I am using heemod for a simulation and I realized that the update related to this issue has changed the results. I checked (by looking at the counts -numebr of people in each state- in each cycle) and realized that the update has changed the package such that with the "beginning" method, transitions happen at the end of the cycle, and with the "end" method, transitions happened at the beginning of the cycle. I think this is probably incorrect though. Maybe there is an error in calculating costs and effects related to the method chosen, but the counts were correct, and now incorrect with this update.
Thanks for your consideration.
from heemod.
Related Issues (20)
- PSA using uncertainty in a survival object HOT 1
- look_up warning message mistakes HOT 1
- Starting_values incorrectly calculated in the ICER calculation HOT 18
- Computational time and survival curve HOT 1
- Survival models with flexible baseline hazards and frailties
- Object 'state_cycle' not found
- Object 'state_cycle' not found HOT 1
- Prof HOT 3
- heemod and rlang 1.0.0 HOT 4
- run_DSA set base strategy HOT 1
- Combining models into total model HOT 4
- Sensitivity analysis - plotting dsa HOT 4
- How can I generate state report just like treeage by heemod package? HOT 4
- compute_surve in DSA HOT 2
- How to run multiple strategies in parallel? HOT 2
- Error with plot_values() function in heemod package
- Axis label in PSM figure
- PFS and OS curves crossing HOT 2
- Memory error when run_psa() and run_dsa() HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heemod.