UofUEpiBio / epiworld

A general framework for quick epidemiological ABM models
https://uofuepibio.github.io/epiworld/
MIT License
6 stars 1 forks source link

`get_hist_transition_matrix` Returning Negative Values #21

Closed IsaccBarker closed 1 month ago

IsaccBarker commented 1 month ago
grouped = transition_matrix.groupby(['dates', 'states_to'])['counts'].sum().unstack().fillna(0)
daily_incidence = grouped.diff().fillna(0)

# Plot!
plt.figure(figsize=(10, 6))
plt.plot(daily_incidence.index, daily_incidence['Infected'], label='New Infected')
plt.plot(daily_incidence.index, daily_incidence['Recovered'], label='New Recovered')

plt.title('Daily Incidence of Infected and Recovered Cases')
plt.xlabel('Days')
plt.ylabel('Number of New Cases')
plt.legend()
plt.grid(True)
plt.show()

image

gvegayon commented 1 month ago

False alarm here; there's no bug (see the tagged PR). Nonetheless, there should be a fix about how to deal with missing values. For the moment, epiworld assigns a -1 integer to individuals with no generation time; which should be treated as missing. @apulsipher, can you create an issue to address this? Title: "Explore how to return consistent missing values in C++ (instead of -1)."

gvegayon commented 1 month ago

https://github.com/EpiForeSITE/epiworld-milo-talk/pull/2