PHYS291 Project – Using the root graphics to study the relation between deaths and the ages of the population.

Marte Hordnes Vår 2020

Project description

My project in PHYS291 is about studying the deaths in Norway for the last three decades and see the numbers in context with the ages of the population. I will try to see if there is a correlation between the two.

In order to do this I found a set of data which I illustrated via graphs by using the root graphics.

The main goal was to try to make two separate graphs and then put them together to see if there is a correlation between the ages of the population and the number of deaths.

Scripts and codes

The scripts used in this project are mainly scripts that will plot a graph from a dataset with given points.

For more complementary information about the scripts, see the links.

Theory and background

The dataset I have used in my project is statistics from SSB – Statistisk Sentralbyrå. SSB is a reliable source which provide solid statistics about everything from health, culture and money, to jobs and people. The first dataset provided in this project shows the number of deaths during the last four decades.

You will find the dataset here: https://www.ssb.no/en/befolkning/artikler-og-publikasjoner/more-similar-life-expectancy-for-men-and-women

The other dataset provided was the overview over the different ages of the population during the same time.

This dataset is here: https://www.ssb.no/statbank/table/07459/

Using the ROOT graphics

To make the first graph I had to make a script which would open the dataset and illustrate the numbers. This script will from now on be referred to as Script1.C

See the full script here:  

Comments to the script:

The script starts with opening the file deaths.csv which is the first dataset. After this, the script consists of a while loop which will go through all of the data from the first year to last year. As long as the loop reads the dataset within these years, it will go on. When the loop has gone through all of the years, it breaks.

At the end of the script the graphs is drawn, both for men, women and bothsexes.

I also added color to the different graphs. As you can see in the script I added names to both the x-axis and y-axis and also the different graphs, but this did not show on the actual graph. For graph 1. See figure 1.

Figure 1 – Graph1_deaths.png

Figure that illustrates the deaths amongst men and women from 1885 to 2015.

The construction of the second graph was a bit more challenging due to the dataset. In order to make an overview I had to make 6 different graphs, one to each gender and the specific age. The different stadiums of ages was:

From 0 – 19

From 20 – 64

From 65 and older

The script contains 6 different for-loops to each of the different ages and genders. At the end of the script it draws the 6 different graphs with different colors.

See the full script here:

Look at figure 2 to see the illustration of the population’s ages during the last decades.

Figure 2 – Graph2_ages_of_population.png

Figure that illustrates the population’s ages from 1985 to 2020

For the last part of the project I wanted to see if there was a correlation between the number of deaths and the ages of the people in Norway at the time. To do this I tried to visualize the two different graphs together with one script. Script2 shows the number of people in all ages at different times, so not all of these where needed. I only needed the two graphs that showed the ages of men and women from 65 and older.

The challenging part about this Script, from now on Script3, was that there was a small difference in years in the two dataset. To make it work I had to let both of the statistics start and end at the same time.

See the full script here:


Figure 3 – Graph_age_and_deaths.png

Figure that illustrates both of the dataset.

Summary and conclusion

As one can see from the graphs it is hard to decide if there is any correlation or not. This is due to the numbers which are very high for the amount of people over 65 but naturally a lot smaller for the number of deaths. Because of the big gap between the two, the graphs are not very easy to read or analyze. For this to be a more user friendly system it probably would be necessary to take into account the big differences in numbers. Another option would perhaps be to zoom in to the graphs that shows the deaths, to be able to analyze them thoroughly.

On the other hand if one take a close look at the graphs of the deaths one can see that there definitely are some increase and decrease. Even though, it does not look like it is a correlation between the ages and the number of deaths.

So to conclude: The scripts made the graphs wanted, and made an overview of the two dataset, but the scripts are not optimal and should be edited for any further use.