DARTH-git / dampack

Decision Analytic Modeling (DAM) package is a suite of functions for analyzing and visualizing the health economic outputs of mathematical models
34 stars 9 forks source link

DSA tornado omits parameters with a negative minimum value #166

Open ronhandels opened 1 year ago

ronhandels commented 1 year ago

Dear dampack developers,

I believe the function owsa_tornado in the file 'owsa.R' applies a filter that omits parameters that have negative minimum values from the tornado plot.

I ran a model with high intervention costs and run the function to produce a tornado plot on the model outcome 'net health benefit', which includes negative NHB values. The owsa_tornado function filters parameters that meet a specific relative threshold in order to 'only plots parameters that lead to a relative change in the outcome greater than or equal to min_rel_diff, which must be between 0 and 1'. Code copied here with reference below:

rel_diff = .data$abs_diff / .data$outcome_val.low) %>% filter(.data$rel_diff >= min_rel_diff)

https://github.com/DARTH-git/dampack/blob/09da4afe8cb56d99637ee1e51a67bfbdae6385d2/R/owsa.R#L207

If .data$outcome_val.low is negative (for example with net health benefit or net monetary benefit), then the rel_diff is negative which will consequently be filtered out as it is lower than the min_rel_diff which can't be set lower than 0. In addition, i believe this function allows to have values higher than 1 (outside the allowed 0-1 range of the min_rel_diff).

I workaround might be to calculate the rel_diff as the (absolute of the difference between high and low) / (highest among all parameters 'absolute of the difference between high and low'). Or alternatively, to take the absolute of the .data$outcome_val.low to allow negative values.

I'm relatively new to github, checked the issues section for duplication of my question and hope I have understood the functionality of the tornado function correctly in combination with its appropriateness for using it for net health benefit outcome. I think for most other outcomes (LY, QALY, cost) my issue is not applicable as they should not contain negative values.

Thanks in advance for considering this issue. Ron Handels