Chapter 14: Correlation and Scatterplots
Chapter 14: Correlation and Scatterplots
14.1 Introduction
Expands discussion of measures of association in statistics.
Focus on methods to measure strength and direction of relationships between numeric variables.
Recommendation to load the
countries2data set and import libraries:descrDescToolsHmiscppcor
14.2 Relationships Between Numeric Variables
Overview of Measurements
Traditional methods (crosstabs, chi-square) are inadequate for numeric variables.
Numeric variables require specific methods to assess relationships.
Example Variables
Dependent Variable: Life expectancy (years) from 190 countries.
Independent Variable: Fertility rate (births per woman of childbearing age).
Hypothesis: Negative relationship between fertility rate and life expectancy.
Data Characteristics
Data characteristics need exploration:
Crosstab for life expectancy vs fertility rate would be unmanageable due to size (100+ columns/rows).
Descriptive Statistics
Life Expectancy Statistics:
Mean: 72.6
Median: 73.9
Skewness: -0.5 (indicating negative skew).
Range: 53 to > 85 years.
Fertility Rate Statistics:
Mean: 2.74
Median: 2.28
Skewness: 0.93 (indicating right skew).
Range: 1 to > 5 births per woman.
Expectation of the Relationship
Expected finding: Low fertility rates correlate with higher life expectancy for reasons:
Pregnancy/childbirth remains a cause of maternal mortality.
High birth rates often align with higher infant/child mortality.
14.3 Scatterplots
Definition and Utility
Scatterplots plot joint outcomes for two variables.
Each point illustrates the values for life expectancy and fertility rate for individual countries.
Example Code (R):
par(mfrow = c(1,1))
plot(countries2$fert1520, countries2$lifexp, xlab="Fertility Rate", ylab="Life Expectancy")
Interpretation of Scatterplot
Vertical axis: Life expectancy (dependent).
Horizontal axis: Fertility rate (independent).
Signals strong correlation:
Low fertility rates correlate with high life expectancies.
Pattern indicates a negative relationship.
14.4 Pearsons's r
Description and Calculation
Pearson's r measures the linear relationship between two continuous variables.
For bivariate correlation:
Values <0 indicate a negative relationship.
Values near 0 indicate no correlation.
Values >0 indicate positive correlation.
Formula for Pearson’s r
Covariance indicates how changes in one variable correspond to changes in another.
Standard deviations normalizes the covariance.
r values range from -1 (perfect negative correlation) to +1 (perfect positive correlation).
Example Computation (with 10 countries)
R Code for computation of deviation and correlation:
X10countries$y_dev = X10countries$lifexp - mean(X10countries$lifexp)
X10countries$x_dev = X10countries$fert1520 - mean(X10countries$fert1520)
X10countries$y_devx_dev = X10countries$y_dev * X10countries$x_dev
X10countries$yvar = X10countries$y_dev^2
X10countries$xvar = X10countries$x_dev^2
Pearson’s r Calculation Steps
calculate deviations for y and x.
get cross-products of deviations.
compute variances.
evaluate whether the data fits a positive/negative pattern.
14.5 Partial Correlation
Partial correlation assesses the relationship between two variables while controlling for a third variable.
Useful to delineate peer impacts, hidden patterns, and co-linearity.
Formula:
14.6 Proportional Reduction in Error (PRE)
Indicates how much variance in the dependent variable is explained by the variance in the independent variable.
Computed as the square of Pearson’s r.
Example:
Fertility rate explains 71% of variance in life expectancy.
Education explains 59% variance.
Population size has minimal impact on variance.
14.7 Correlation and Scatterplot Matrices
Highlight relationships among multiple variables.
Useful for visual exploration and quick reference to correlation strength.
R code: To create a scatterplot matrix
plot(lifexp_corr, cex=.6)
14.8 Overlapping Explanations
Warns against overstatement of impact when variables are correlated.
Consider overlaps in variance between independent variables that can distort perceived effects on dependent variables.
Potential for double-counting errors in influence measurement.
14.9 Next Steps
Transition to regression analysis for deeper exploration of relationships among numeric variables.
Multivariable regression models will include multiple independent variables to better predict dependent outcomes.
14.10 Exercises
Practical Application
Analyze relationships and identify positive/negative correlations.
Use scatterplots to illustrate correlations and evaluate statistically.
R Functions to derive key statistics for shared variances and relationships.