GBADsInformatics / GBADsDPM.R

GNU General Public License v3.0
0 stars 0 forks source link

Bug in `run_compartmental_model.R` for value of total mortality #6

Open jphill01 opened 10 months ago

jphill01 commented 10 months ago

There is a pesky bug in the code at lines 699-714 regarding the value of total mortality for all age:sex groups.

e.g.

res_vec$Value_of_Total_Mortality_NF[month] <- res_vec$Total_Mortality_NF[month] * fvNF

res_vec is a list of vectors for variables of interest fvNF is the financial value for neonatal females and is a vector of length nruns (here, 10000) month is a looping index ranging from 1-12

At the end of a simulation run, Value_of_Total_Mortality_NF contains 12 values. However, the above line of code is not valid in R.

The LHS is a single value, while the RHS is vector of length nruns.

Gemma's code throws a warning, so something is amiss. I have emailed her to inquire.

jphill01 commented 9 months ago

Gemma responded that the code should be

res_vec$Value_of_Total_Mortality_NF[month] <- res_vec$Total_Mortality_NF[month] * sample(fvNF, 1)

since fvNF is a distribution.

It seems someone altered the code at some point. We're currently digging into it.