covid19-sir: [Fix] too long delay period of Hungary with Scenario.estimate_delay()

Summary

As discussed in #670, Scenario.estimate_delay() returns 53 days as delay period of hungary and this is too long. This causes change points detection failure in S-R trend analysis.

We may need to revise Scenario.estimate_delay() to get many data for “Period Length” calculation. We have only 11 records for Hungary as an example.

Codes

snl = cs.Scenario(country="Hungary", province=None)
snl.register(jhu_data, population_data, extras=[oxcgrt_data])
# 53, dataframe
delay, df = snl.estimate_delay()
# S-R trend analysis
_ = snl.trend()

Outputs

Index Confirmed Stringency_index Period Length
0 48757 40.74 NaN
1 32 50 12
2 32 50 36
3 32 50 29
4 4183 54.63 17
5 94916 57.41 53
6 3990 61.11 31
7 3741 66.67 53
8 300 71.3 2
9 366279 72.22 5
10 2443 76.85 118
11 614612 79.63 19

trend_20_Hungary

Environment

  • CovsirPhy version: 2.17.0-pi
  • Python version: 3.9.2
  • Installation: poetry
  • System: WSL (Ubuntu)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

This line will be removed if 0.75 for Q2 was added as an argument?

I think yes, because Q2 is stricter and more specific than values < quantile(0.99).

I like the idea with phase-specific delay period, and I agree we could either merge phases using this metric or RMSLE, whichever works better.

Sorry for the delayed test pull request, I will try to create it by tomorrow.