zward / Amua

An open source modeling framework
GNU General Public License v3.0
33 stars 11 forks source link

Beta >0 in Tables #54

Open amarkelkar opened 2 years ago

amarkelkar commented 2 years ago

I'm working on a CEA and running into the issue of Amua telling me that the analysis won't run because the b-value in a Beta distribution must >0 [Beta(a,b,~)]. However, I've double-checked my tables and none of the listed values are 0. I also ran individual tables and identified 2 tables that were the issue, but I can't figure out why those two are having issues while the others are not. I've double-checked my code and there's nothing different about how I'm referencing those two tables: if (n_Tx_line==3, Beta(p_Progression_3rd_line_CAR_Table[n_CAR_months,6], p_Progression_3rd_line_CAR_Table[n_CAR_months,5], ~),0)

I'm not sure if this is an issue with interpolation creating some "0" values or something else ... has anyone else experienced this or have any advice?

zward commented 2 years ago

It sounds like it could be an interpolation issue. What type of interpolation are you using for the tables? If cubic splines, there may be some oscillations that dip below 0 (usually near the bounds). You could try calling/plotting different values returned from the table to see if this is the case. Another approach (more of a hack) could be to use abs() or max(), or add a small constant to ensure the values are positive, or interpolate in log-space and exponentiate to ensure b>0.

amarkelkar commented 2 years ago

Thanks for the suggestions. I've tried switching to Linear interpolation without any improvement. I also tried putting max() and abs() limits both inside and outside my Beta() statements without resolution either. Screenshot 2021-09-19 205437

zward commented 2 years ago

If you send me a copy of the model (zward@hsph.harvard.edu) - or another reproducible example - I can try to debug to see what is going on.

amarkelkar commented 2 years ago

Thanks so much Zach! I just sent it to you.