This week, we were instructed to use Python to calculate the Pearson Correlation for two variables in our chosen dataset. I went back to my original question, which was whether, according to the 2012 Outlook on Life survey, respondent religiosity correlated with respondent acceptance of others outside their ethnicity. To do this, I combined several questions to calculate indices for each measure. The graph looked like this:
data_clean=data.dropna()
print ('association between Religiosity Index and Racial Acceptance Index')
print (scipy.stats.pearsonr(data_clean['RELIND'], data_clean['ACCIND']))
The output was: r = -0.09, p = 0.15. Therefore, the Pearson Correlation confirms no significant relationship between the to variables. Squaring r gives us r^2 = 0.0081, a miniscule proportion of variability in racial acceptance that might be credited to religiosity.
No comments:
Post a Comment