piątek, 8 kwietnia 2016

Data Analysis Tools: WEEK 2

Chi Square Test of Independence


Assignment: Running a Chi-Square Test of Independence
Source: GapMinder
Variables usedincomeperperson, lifeexpectancy

*incomeperperson – Gross Domestic Product (GDP) per capita
*lifeexpectancy – The average number of years a newborn child would live if current mortality patterns were to stay the same.

Introduction:
In this assignment, I decided to analyze whether the wealth of the country affects the life expectancy of its citizens. I´m interested which countries (with high, middle, or low GDP) have more results of Life Expectancy over 70 years old.

As both of the chosen variables are quantitative, I collapsed them into categories and created new variables:

GDP: new variable with 3 categories for incomeperperson; “1” (Low Income Countries), “2” (Middle Income Countries) and “3” (High Income Countries).

Life: new variable with 2 categories for lifeexpectancy; “1” (Life 
expectancy of 70 years or less), “2” (Life expectancy of more than 70 years)

CODE:   


Model Interpretation for Chi-Square Tests:
When examining the association between the life expectancy, represented as “life” (categorical response) in data set, and the wealth of the country, represented as “GDP” (categorical explanatory) in data set, a chi-square test of independence revealed that among 176 countries in the data set, those with high GDP per capita tend to have higher number of results with Life Expectancy over 70 years (100.00 %), compared to countries whose GDP per capita is middle (77.27%) or low (3.77%). In this analysis, X2=103.7888, df=2 and P<0.0001.



Model Interpretation for post hoc Chi-Square Test results:
A Chi Square test of independence revealed that among 176 countries, the range of the wealth of a country (“1” high income, “2” middle income, and “3” low income) and life expectancy rate (which is showed as “life” categorical variable) were significantly associated, X2 =103.7888, df= 2, p<0.0001.
Post hoc comparisons of GDP, by pairs of its height range, revealed that countries with higher GDP per capita (in terms of three levels of a country´s wealth) reported higher score of life expectancy over 70 years. The relationship between Life Expectancy and GDP was proven in each of the comparisons tests. The p value in each test was lower than 0.016667, i.e. p value after the Bonferroni Correction for 3 comparisons.








Brak komentarzy:

Prześlij komentarz