Wednesday, December 9, 2020

Pearson Correlation of Religiosity to Racial Acceptance

 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:


So, visually we can surmise that there is no correlation.  I ran the Pearson Correlation using Python, and the code snippet reads:

#calculate and print Pearson Correlation
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

Testing a Basic Linear Regression Model on the Outlook on Life Survey

 In review, I am working with the 2012 Outlook on Life Survey, specifically the relationship between Religiosity (RELIND, an aggregate index...