Closed lisphilar closed 3 years ago
Additionally, Scenario.timepoints(first_date=None, last_date=None, today=None)
will be added.
first_date=None
means the first date will be set as the min date of the recordslast_date=None
means the last date will be set as the max date of the recordstoday=None
means today is the same date as the last dateI have some quick questions about the today/timepoints feature:
today
property does not apply a limit in trends/records/pcr plots right? I mean that if for example I have snl.timepoints(today="1Apr2021", last_date="10Apr2021")
, the plot of trends and records will be up to last_date
, not only up to today
.PCRData.positive_rate()
has option for last date? Because I think even with set timepoints, it still plots data up to today.[Update: merged multiple comments into single]
Could you provide all codes?
Yes, just a typical scenario analysis for Italy for example:
import covsirphy as cs
data_loader = cs.DataLoader(directory="kaggle/input")
jhu_data = data_loader.jhu()
population_data = data_loader.population()
oxcgrt_data = data_loader.oxcgrt()
pcr_data = data_loader.pcr()
country = "Italy"
ita_scenario = cs.Scenario(jhu_data, population_data, country)
ita_scenario.register(extras=[oxcgrt_data])
ita_scenario.timepoints(today="1Apr2021", last_date="10Apr2021")
pcr_data.positive_rate(country)
_ = ita_scenario.trend()
ita_scenario.estimate(cs.SIRF)
Scenario.records()
is expected to show records to the last date (not today) because this is a method to show all records.Scenario.trend()
is expected to analyse data to today. Documentation succeeded, but not for the codes? If not, this is a bug.PCRData.positive_rate()
does not have last_date
option as you can see with source codes.
Summary of this new feature
As discussed in #560, the reference date to determine whether a phase is a past phase or a future phase is necessary for
Scenario
class. This propertyScenario.today
will enable us to perform retrospective analysis more effectively.Let's say we have JHU-type data from 01Jan2020 to 31Dec2020. The following scripts will perform parameter estimation with the records from 01Jan to 30Nov, and predict parameter values from 01Dec to 31Dec. Finally, forecasted number of cases from 01Dec to 31Dec will be compared with actual number of cases from 01Dec to 31Dec.
In version 2.16.2, property
.today
above is set to the same date as.last_date
. This means actual records from 01Dec2020 to 31Dec2020 are removed from the figure of.history()
..today
should be independent to show actual values from 01Dec to 31Dec.