ashokkrish / spatialEpisim

spatialEpisim: Spatial Tracking of Infectious Disease Epidemics using Mathematical Models
GNU General Public License v3.0
8 stars 5 forks source link

linearInterpolationOperator() function has an argument called 'compartmentsReported' that defaults to 1 #53

Closed ashokkrish closed 1 week ago

ashokkrish commented 2 weeks ago

When Hmat is created within rasterSimulation_DA.R the argument argument called 'compartmentsReported' is being defaulted to 1.

Hmat <- linearInterpolationOperator(terra::rast(stack$rasterStack), healthZoneCoordinates)

What happens if we try to assimilate two epidemic states, I and D?

bryce-carson commented 2 weeks ago

states_observable was always hard-coded to one in the old code. Other areas of the code for BDA which are influenced by the state space size (one, two, etc.) used this hard-coded value.

https://github.com/ashokkrish/spatialEpisim/blob/be6045650fd72c0a911ce8ff8078e97a4d191a6f/R/rasterSimulation_DA.R#L334-L347

https://github.com/ashokkrish/spatialEpisim/blob/be6045650fd72c0a911ce8ff8078e97a4d191a6f/R/rasterSimulation_DA.R#L650-L660

I set the default value of compartmentsReported argument to one in linearInterpolationOperator to reflect that in the old code it is always called with a value of one. This allows the function to be called without passing states_observable as the value for the argument compartmentsReported, and it will proceed just as if that argument value was passed. If and when the old code is modified so that states_observable is not hard-coded I will modify the function call of linearInterpolationOperator so that the default argument value is not used. In the new code the argument value is always determined dynamically based on the number of data frames you provide to be used for assimilation.

In summary, the old code was always proceeding under the assumption only one compartment's observed values were reported and assimilated.