Data Analysis and Tools Week 2

This week’s assignment focus is on running a chi-square test of independence.  My research explores the relationship between the level of openness of a society and the economic well-being of the citizens. My hypothesis is that countries with a more open society will have a higher level of economic well-being.  The python code can be found in the Jupyter notebook for this week.


I have followed the definitions of the Polity IV study in classifying countries into 5 types based on their polity score.  The following summarizes their distribution:


Type of Government Count
Full Democracy 32
Democracy 57
Open Anocracy 19
Closed Anocracy 27
Autocracy 20

Economic Well-Being

In the past weeks I have divided the economic well-being measure into quartiles.  Here’s the count of countries by income quartiles:


Income Class Count
0% to 25% 123
25% to 50% 12
50% to 75% 12
75% to 100% 8

I did not want to compare a 4×5 matrix so for simplicity sake I rolled the income classes up into a single measure.  It is if the country is in the top half of the income distribution or not.

Chi Square

The null hypothesis is variable independence. I ran a chi square test on this data which resulted in a p-value of 0.00000000142, so we would reject the null hypotheses.  The presence of a country in the top half of the income distribution is a function of the type of government.

Post Hoc Test

I tested the 10 combinations pairwise using the Bonferroni adjustment. Since there are 10 combinations the p-values need to be adjusted by one decimal place.

Only in the cases where the full democracy was compared against the other types resulted in p-values significantly large to reject the null hypothesis.   The most meaningful interpretation of these results is that all of the other groups are homogeneous. The full democracy group is different. Once again the python code used in this analysis can be found in the Jupyter notebook for this week.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s