[PYTHON] Examine the margin of error in the number of deaths from pneumonia

If Covid19's deaths were counted for pneumonia, we would like to know how much it can be said to be an error. Since there are clearly seasonal fluctuations and trends, we will look at the variation in the residuals after removing each.

Time series analysis

Data from vital statistics. We will confirm the monthly changes in the number of deaths from 2,015 to 2,018. The vertical axis is the number of deaths, and the horizontal axis is the month.

4nen.png

12-month cycle without looking at partial autocorrelation. Every year, there is a trend of rising overall.

This time, the death toll from pneumonia is taken as 9% of the total (from the material at the end of the post), and it is decomposed into trends, seasonal fluctuations, and residuals using an additive model. Use seasonal_decompose from StatsModels in an additive model (it should be repeating the moving average to calculate seasonal variation)

Y[t] = T[t] + S[t] + e[t]

T is the trend, S is the seasonal variation, e is the residual


import statsmodels.api as sm

#
#death is data that contains only the number of deaths in one column
# 

dec = sm.tsa.seasonal_decompose(death,period=12)
trend = dec.trend
seasonal = dec.seasonal
residual = dec.resid

Data plot

trend

trend.png

Seasonal variation

seasonal.png

Residual error

residual2.png

Conclusion

The minimum residual value is -409.1 and the maximum value is 282.8. The standard deviation is 136.5. The average is -4.59. When it comes to an increase of 1,000 or more, the impression is that it probably contains a lot of Covid19.

Assuming a case fatality rate of 2%, if the number of infected people is about 50,000, the line of 1,000 dead.

With Covid19 patients sparsely distributed throughout the country, it is difficult to see the increase in deaths from pneumonia from hospitals (the number of hospitals without mental hospitals should be more than 7,000, about one more. Not even).

Data by cause of death nationwide will be delayed by 5 months, so In order to grasp the current situation, it is necessary to look for a fast place in the bulletin of the local government. It may not exist.

About the current situation

Currently, two weeks have passed since the expert meeting designated the remaining 1-2 weeks in Japan. A state of emergency has been declared in NY, and the damage in the EU is becoming more serious.

In Japan, no damage has been reported as much as in the EU and South Korea, The characteristics of the virus that is prevalent in the main are different, the medical system is different, etc. There are various possible factors, and there is not enough data to link to a specific scenario.

If the environment is equivalent to that of Wuhan virus and similar to that of Europe and the United States, The death toll numbers are lower than expected, so we examined whether the data could detect whether Covid 19 deaths were among the pneumonia deaths.

(I'm just fixing the virus and environment as variables, I'm not judging that, and the verification of other scenarios is a different story. I confirmed this much this time)

data

Monthly death data (annual deaths and mortality rate by month of death (per 1,000 population)): https://www.e-stat.go.jp/stat-search/files?page=1&layout=datalist&toukei=00450011&tstat=000001028897&cycle=7&year=20180&month=0&tclass1=000001053058&tclass2=000001053061&tclass3=000001053065&result_back=1

There is a preliminary report on the total number of deaths by month, and the latest is 2 months ago (Vital Statistics Bulletin for November 19): https://www.mhlw.go.jp/toukei/saikin/hw/jinkou/geppo/s2019/11.html

Monthly approximate number by cause of death (latest 5 months ago) https://www.e-stat.go.jp/stat-search/files?page=1&layout=datalist&toukei=00450011&tstat=000001028897&cycle=1&year=20190&month=23070909&tclass1=000001053058&tclass2=000001053060

Pneumonia (Death due to pneumonia in Japan from the viewpoint of vital statistics): http://www.tokyo-eiken.go.jp/sage/sage2018/

Recommended Posts

Examine the margin of error in the number of deaths from pneumonia
The story of an error in PyOCR
Output the number of CPU cores in Python
Find the number of days in a month
Used from the introduction of Node.js in WSL environment
How to get the number of digits in Python
Count the number of parameters in the deep learning model
Calculation of the minimum required number of votes from turnout
Get the size (number of elements) of UnionFind in Python
Examine the parameters of RandomForestClassifier in the Kaggle / Titanic tutorial
Visualize the number of complaints from life insurance companies
Let's examine the convergence time from the global trend of the effective reproduction number of the new coronavirus
[Python] Representing the number of complaints from life insurance companies in a bar graph
How to find the optimal number of clusters in k-means
Maya | Find out the number of polygons in the selected object
Analyzing data on the number of corona patients in Japan
Get the number of digits
Count the number of characters in the text on the clipboard on mac
Get the number of specific elements in a python list
Python --Find out number of groups in the regex expression
VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
[Homology] Count the number of holes in data with Python
Get the number of occurrences for each element in the list
Calculate the number of changes
What beginners learned from the basics of variables in python
I tried to find the trend of the number of ships in Tokyo Bay from satellite images.
[Python] Let's reduce the number of elements in the result in set operations
Error in ordinal number when importing Numpy in Anaconda environment of Windows
Get the number of readers of a treatise on Mendeley in Python
Get the number of views of Qiita
The story of participating in AtCoder
Existence from the viewpoint of Python
Calculation of the number of Klamer correlations
The story of the "hole" in the file
Get the number of Youtube subscribers
Examine the Lie-Trotter formula censoring error
Examine the object's class in python
The meaning of ".object" in Django
[Question] In sk-learn random forest regression, an error occurs when the number of parallels is set to -1.
[Completed version] Try to find out the number of residents in the town from the address list with Python
A story about creating a program that will increase the number of Instagram followers from 0 to 700 in a week
"The guy who predicts the number of views from the title of Jaru Jaru's video"
Graph of the history of the number of layers of deep learning and the change in accuracy
Generate a list packed with the number of days in the current month.
Check the in-memory bytes of a floating point number float in Python
[Python] Calculate the number of digits required when filling in 0s [Note]
Graph the change in the number of keyword appearances per month using pandas
Trends in programming languages from the perspective of GitHub (updated semi-annual changes)
I tried to predict the number of people infected with coronavirus in consideration of the effect of refraining from going out
[Competition Pro] Solve the number of M cards taken out from N cards using a route [Explanation in the figure]
[Understanding in 3 minutes] The beginning of Linux
Check the behavior of destructor in Python
Count / verify the number of method calls.
Implement part of the process in C ++
Learning notes from the beginning of Python 1
Omit BOM from the beginning of the string
What is the cause of the following error?
[Python] Understand the content of error messages
Resolve the Address already in use error
The result of installing python in Anaconda
Let's claim the possibility of pyenv-virtualenv in 2021