INQStats: A free and easy to use statistics app for your smartphone

June 07, 2016

Making data collected by governments and international organizations available for everyone has become a big trend lately. There are a lot of attempts to make this data sets not only available but also processable and analyzable and easy to use for anyone - some examples are Google Public Data or gapminder.org.

Inqubu now has published a new app called INQStats that brings the world of open government data to the Smartphone. In the first version, INQStats can display numerous statistical data of all countries of the world and show historical data as well. Currently available data sets are:
  • Population
  • Birth rate
  • Internet users
  • Literacy rate
  • Median age
  • GDP
  • Gini coefficient
  • Unemployment rate
  • Government debts
and a lot more. Data is derived semi automatically from various sources (e.g. UN-Data, Worldbank.org, OECD) and is constantly updated. Data is also stored locally so the app can be used even if no Internet connection is available. The overall goal of INQStats is to give a quick overview of data from several countries, compare it and show the historic development.

The app is available for free for Android and Windows Phone currently. A browser based version can be found here.

If you have any feedback, don't hesitate to contact us! Feel free to share or comment your opinion to INQStats!

Android Version: https://play.google.com/store/apps/details?id=inqubu.INQStats
Windows 10 Version: https://www.microsoft.com/store/apps/9nblggh683f1


INQStats open API published to get demographic data

June 02, 2016

With this blog post we want to introduce a new API at http://inqstatsapi.inqubu.com that can be used publicly and free of charge by anyone. The purpose of this API is to provide an up-to-date collection of demographic data of all countries of the world. If you want to see what is possible with this API, check out the official INQStats Public Data Explorer: http://inqstats.inqubu.com.
For you, there are just two simple steps necessary to get started:


Step 1: Get an API key

Please fill in the following form to get your personal API key immediately. The purpose of this process is to get an overview of how the API is used and to prevent abuse.

Step 2: Make requests

The API is accessible via REST interface. The following parameters can be passed in the request:

Key Description Cardinality
api_key This is a mandatory value. It must be provided with every request. Please fill in the form above to get your personal API key. 1
data A list of data keys that should be returned, separated by commas without spaces (please see list below to get an overview about all available data keys). 1...*
countries A list of countries for which data should be returned. Please use the ISO 3166-1 alpha-2 format for countries separated by commas without spaces (e.g. us = United States, de = Germany, etc.) 1...*
years Optional. It can be used to get data from a specific year. If this parameter is not set, the five most up to date values are returned. Use a comma separated list to get data from several years (e.g. years=2011,2012,2013), you can also set a range (e.g. years=2011:2013 which will return all data between 2011 and 2013 if available) 0...*
lang Optional. States, in which language values are returned. Available options are: en (English; default), de (German), es (Spanish), pt (Portuguese), fr (French), it (Italian), ru (Russian), zh (Chinese). 0...1

Subsequently, a list of all available data keys is given:

Key DescriptionSource
bigmac_index Returns the price for a Big Mac by McDonald's™ derived from www.bigmacindex.org (unit: USD). www.bigmacindex.org
birth_rate The average number of birth per year per 1,000 population. Worldbank
co2_emissions Returns the CO2 emissions in metric tons per person per year. Global Carbon Atlas
corruption_index Returns the Corruption Perceptions Index (CPI) published by www.transparency.org (scale: 0-100; 0 = high corruption. 100 = low corruption) www.transparency.org
density Returns the population density of a country (per km²). -
death_rate The average number of death per year per 1,000 population. Worldbank
debts The total amount of government borrowings (unit: USD). Worldbank
debts_capita The amount of government borrowings per person (unit: USD). Worldbank
debts_percent The percentage of government borrowings in relation to the GDP. Worldbank
diabetes_prevalence The percentage of people ages 20-79 who have type 1 or type 2 diabetes. Worldbank
education_expenditure Returns the public expenditure on education (in % of the GDP for a country). Worldbank
electric_energy_consumption Returns the amount of electric energy consumed (in kWh/capita) Worldbank
fifa Returns the ranking of a country in the FIFA™ football ranking board. www.fifa.com
first_marriage_men Returns the age of first marriage for men. Worldbank
first_marriage_women Returns the age of first marriage for women. Worldbank
fixed_telephone_subscriptions Returns the number of landline phone subscriptions (per 100 population) Worldbank
forest_area Returns the total amount of forest area in a country (in km²) Worldbank
forest_area_percent Returns the percentage of the land area covered by a forest for a country. Worldbank
gdp_total Returns the total Gross Domestic Product (GDP) for a country (unit: USD). Worldbank
gdp_capita Returns the Gross Domestic Product per person for a country (unit: USD). Worldbank
gini Returns the Gini coefficient. The Gini coefficient states how uniformly assets are distributed in a country (scale: 0-100; 0 = equal distribution. 100 = unequal distribution) Worldbank
happiness_index Returns the values of the world happiness survey of the UNSDSN. The higher the value, the happier the country. UNSDSN
hdi Returns the Human Development Index (HDI). It is published by the United Nations and combines several parameters (e.g. life expectancy or GDP). Scale: 0-1; 0 = low development. 1 = high development. UN-Data
health_expenditure Returns the public expenditure on health (in % of the GDP for a country). Worldbank
hiv_prevalence The percentage of people ages 15-49 who are infected with HIV Worldbank
inflation Returns the annual change of consumer prices (unit: %). Worldbank
internetuser Returns the total number of people that are actively using the internet. Worldbank
internetusers_percent Returns the percentage of people, that are actively using the internet for a country. Worldbank
jobless_rate The number of unemployed people in relation to the labor force for a country. Worldbank
life_expectancy The average number of years a person will live (at birth). UN-Data
literacy_rate Returns the percentage of people, that have the ability to read and write by the age of 15. Worldbank
medianwage Returns the median monthly wage before taxes including public benefits (e.g child allowance); unit: USD. Worldbank
median_age The median age of the population. UN-Data
migration Returns the total number of people that emigrated or immigrated. UN-Data
migration_rate Returns the net migration rate (per 1,000 population). UN-Data
military_expenditure Returns the military budget (in % of the GDP for a country). Worldbank
mobile_cellular_subscriptions Returns the number of mobile phone subscriptions (per 100 population) Worldbank
murder_rate Returns the number of homicides (per 100,000 population). UNODC
new_businesses_registered Number of new limited liability corporations registered in the calendar year. Worldbank
olympicsummergames_goldmedals Returns the number of gold medals a country won at the Olympic Games. IOC
olympicsummergames_silvermedals Returns the number of silver medals a country won at the Olympic Games. IOC
olympicsummergames_bronzemedals Returns the number of bronze medals a country won at the Olympic Games. IOC
population Returns the population of a country. UN-Data
population_0_14 Returns the percentage of people between the age 0 and 14. Worldbank
population_15_64 Returns the percentage of of people between the age 15 and 64. Worldbank
population_over_64 Returns the percentage of people who are older than 64 years. Worldbank
pressfreedom_index Returns an index derived from "Reporters without borders" that reflects how free the press of a country is. The lower the value, the better the freedom of press. www.rsf.org
research_expenditure Returns the public expenditures on scientific research (in % of the GDP for a country). Worldbank
scientific_journal_articles The number of scientific publications in medical or natural sciences. Worldbank
size Returns the area of a country (unit: km²). UN-Data
tax_revenue Compulsory transfers to the central government for public purposes (in % of the GDP for a country). Worldbank
tax_revenue_total Compulsory transfers to the central government for public purposes (in US-Dollar). Worldbank
tourist_arrivals The number of foreign citizens that stayed at least one night in the country. This includes hotel stays, transfers, conference visits, etc. UN-Data
tourism_expenditure The amount of expenditures dedicated for tourism (in % of the GDP for a country). UN-Data
urban_population Returns the percentage of people who live in a city. Worldbank

If there is no value to display, either "null" or "N/A" in string format is returned.
In the following, a sample request is given. This will return the population of the last five years of the United States and Great Britain (note, that you have to replace the api_key parameter with your own key):

GET http://inqstatsapi.inqubu.com?api_key=ADDYOURKEYHERE&data=population&countries=us,gb

Step 3: See the results

The response format is JSON and has the following structure:

Key Description
countryCode The ISO country code.
countryName The full country name
[data key] The rest of the JSON object contains all data keys you passed in the request as a key-value-pair.

Subsequently, the response for the sample request above is given:

[{"countryCode":"us","countryName":"USA","population":[{"year":"2014","data":"318857056"},{"year":"2013","data":"316128839"},{"year":"2012","data":"313914040"},{"year":"2011","data":"311587816"},{"year":"2010","data":"309326225"}]},{"countryCode":"gb","countryName":"United Kingdom","population":[{"year":"2014","data":"64510376"},{"year":"2013","data":"64097085"},{"year":"2012","data":"63227526"},{"year":"2011","data":"62752472"},{"year":"2010","data":"62271177"}]}]

If the request was not successfull, a JSON object containing a "type" and "msg" key will be returned. In the following, an example is given:

{"type":"error","msg":"Invalid data argument."}

Here is a JSFiddle which gets data from INQStats and displays the number of internet users in Austria, Germany and the United States:

Step 4: Get data for all countries

If you need a list of all countries of the world for a specific data parameter, you can add the parameter cmd=getWorldData. The subsequent request will return a list of the population for each country of the world for the year 2000. Note, that the parameter year is optional. If it is not set, the most recent data will be returned.

GET http://inqstatsapi.inqubu.com/?api_key=ADDYOURKEYHERE&cmd=getWorldData&data=population&year=2000

The response format is a list containing JSON objects, see the example below:

[{"countryName":"Afghanistan","countryCode":"af","population":"19701940","year":"2000"},{"countryName":"Egypt","countryCode":"eg","population":"68334905","year":"2000"},{"countryName":"Albania","countryCode":"al","population":"3089027","year":"2000"},{"countryName":"Algeria","countryCode":"dz","population":"31183658","year":"2000"}, ...

We hope you can use this API to build some awesome applications! If you have any questions, don't hesitate to contact us!


How to proof that storks bring babies

June 02, 2016

It is one of the most common warning when someone deals with statistics for the first time: Correlation does not imply causation. This means, just because some variables seem to show dependencies, it doesn't mean that they are really dependend from each other. There are a lot of examples for so called "spurious relationship" between variables but one of the most famous is the claim, that babys are delivered by storks and the statistical "proof" for this statement.

Here is a list of several countries, the birth rate and the number of storks:

Country Storks Birthrate
Albania 100 83
Belgium 1 87
Bulgaria 5000 117
Denmark 9 59
Germany 3300 901
France 140 774
Greece 2500 106
Netherlands 4 188
Italy 5 551
Austria 300 87
Poland 30000 610
Portugal 1500 120
Rumania 5000 23
Spain 8000 439
Switzerland 150 82
Turkey 25000 1576
Hungary 5000 124

If we now want to know how birthrate and number of storks are related, we may first calculate the correlation coefficient between the birth rate and the number of storks. The correlation coefficient is a value between -1 and +1 and tells us, if there is a linear correlation between variables. A value of -1 means, there is a perfect negative linear correlation, a value of +1 means, there is a perfect positive linear correlation. A value of 0 means, there is no linear correlation at all. The following picture gives an overview about two variables X and Y and their correlation coefficient:

If we plot the number of storks on the X axis and the birth rate of a country on the Y axis and add a regression line, we get the following picture:

The interesting thing here is that the correlation between these values is 0.6 which is not pretty high but also not pretty low. But maybe, this correlation is just coincidence and it would also appear if we would use random values. To check this, we can use the p-value. The p-value tells us: If our first assumption that there is no correlation between birthrate and the number of storks is true, then there is just a possibility of 0,8% that we may see the result that we've just received (a correlation of 0.6). In other words: The smaller the p-value, the more likely is it that our assumption (there is no connection between birth rate and number of storks) is false. Or in other words again: The coherence of birth rate and number of storks is pretty significant which could lead to the conclusion that babies are delivered by storks.

But, since we know that this is not true, what is the explanation behind this phenomenon? There are multiple attempts to explain it, in the first place, there could be a "hidden" variable that influences both, the birth rate and the number of storks and causes the apparent connection between these variables. In our case, the explanation is quite simple: The more untouched the nature of a country is, the more storks tend to live there. Countries with a sound nature and a lot of living space for animals tend to be poorer than industrialized countries. And poorer countries tend to have a higher birth rate.

With the same setup, we can also find a high correlation between the shoe size and the read capability. If the shoe size is big, the read capability is better as well. Of course, also in this case we can observe a spurious relationship between shoe size and read capability: Older children have better read capabilities than younger children. Adults have better read capability than children. Since the shoe size of adults is bigger than those if children, we see a positive correlation between shoe size and read capability even though the assumption, people with bigger feet can read better is pretty false.

Reference: http://www3.math.uni-paderborn.de/~agbiehler/sis/sisonline/struktur/jahrgang21-2001/heft2/Langfassungen/2001-2_Matth.pdf


Why women live longer than men

June 02, 2016

In almost every country, there is a significant disparity between the life expectancy of men and women. The estimated life expectancy has a significant influence on our daily life, even if we’re not aware of it: Insurance companies for example calculate the premium of life assurances based on so called mortality tables (Sterbetafeln). One of these tables for Austria is depicted below. The x-axis shows the age of a person, the y-axis the probability that this person will die in the shown year.

There are multiple interesting things to observe in this graph. First, the probability of mortality suddenly decreases dramatically after the age of one year (this is caused by the fact that babies are more endangered by diseases that are typically harmless for adults) and increases again by the age of 13. After a stagnation between the ages 18 and 31, by the age of 32, the mortality is increasing constantly again. We can also observe a difference between males and females as woman have a lower mortality from the early age on till the age of 90 when the life expectancy is almost identical for both sexes.

The reason for this disparity is subject of several discussions and there are multiple reasons that are named. The most common attempted explanations are that men usually are living unhealthier and risky lives. Some other argue that the lower life expectancy is based on biological reasons. Others point out that the Second World War may has caused the inequality because men were directly involved in battles and also suffered from late complications of war wounds.

In a survey called the Cloister-Study, researchers tried to answer this question by investigating the life expectancy in monasteries. Their assumption was that the life expectancy of monks and nuns should be equal since both follow a similar style of living, far away from the risks of the daily life of average people. The results of the study is shown in the graph below. The x-axis shows the observed year, the y-axis the life expectancy after the age of 25. The red thick line shows the life expectancy of nuns, the red thin line the life expectancy of woman in general (same for monks and men).

As it can be seen, nuns usually live longer than monks but the disparity is less significant than between women and men in general. However, there is a high difference between the life expectancy of men and monks. The gap between monks and nuns that opened up in the 1970’s may be caused by the smoking behavior in monasteries. While smoking was generally prohibited in nunneries, monasteries were less stringent concerning this topic. It also becomes evident that biological reasons only have little influence of the disparity of life expectancy since monks live up to 5 years longer compared to all men. So, as a man you have two options to live longer: Either live healthier and avoid risks or become a monk.

References:

Life expectancy of men and women in monasteries (German): Follow