0% found this document useful (0 votes)
5 views15 pages

Module 2

This guide explains how to analyze the relationship between two variables using correlation and regression techniques. It emphasizes the importance of visualizing data, quantifying relationships with Pearson's r, modeling trends with regression lines, and evaluating model fit with R-squared. Additionally, it warns against assuming causation from correlation and highlights the impact of outliers on results.

Uploaded by

Mai Anh Nguyen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

Module 2

This guide explains how to analyze the relationship between two variables using correlation and regression techniques. It emphasizes the importance of visualizing data, quantifying relationships with Pearson's r, modeling trends with regression lines, and evaluating model fit with R-squared. Additionally, it warns against assuming causation from correlation and highlights the impact of outliers on results.

Uploaded by

Mai Anh Nguyen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
Seeing the Story in Your Data: A Guide to Correlation & Regression From Visualizing Patterns to Making Predictions Are these two things related? We constantly look for connections. Does eating more chocolate lead to higher body weight? Are taller U.S. presidents more popular? This guide provides the statistical toolkit to move from simple curiosity to data-backed insight, showing you how to investigate the relationship between two variables. Step 1: First, See the Relationship Before any calculation, always look at your data. The right chart reveals the nature of the relationship at a glance. For Categorical/Ordinal Data Contingency Table Use a contingency table to display the relationship between two ‘ordinal or nominal variables. I's lke a frequency table, but for two variables at once. Example Question: Are more educated people more likely to, believe in extraterrestrial ife? Belief in Aliens by Education Level Low Middle High (N=109) _(N=102) (N=50) Agree 12% 25% 50% Disagree 63% 36% 16% Key Insight: Among the low-educated, only 12% agree. Among the high-educated, 50% agree. The data reveals a pattern ‘opposite to the intial hypothesis. For Quantitative Data Scatterplot Use a scatterplot to dispiay the relationship between two Quantitative variables. Each dot represents one case or individual. Example Question: Does higher chocolate consumption correlate with higher body weight? Body Weight (ka) ‘Chocolate Consumption (grams/week) What Story Is the Scatterplot Telling? A scatterplot reveals three key features of a relationship. The tools in this guide focus specifically on linear relationships. 1. Direction 2. Strength 3. Form ” ale a rs Positive Negative Strong Linear Curvy-tinear Correlation Correlation (as Xincreases, (as X increases, Yincreases) YY decreases) Warning: The methods we'll discuss next are designed to measure linear relationships. A low linear correlation score doesn't mean there's no relationship at all—it could be curvy-linear! Step 2: Quantify the Linear Relationship with Pearson’s r A scatterplot gives us a feel for the relationship, but Pearson's r gives us a precise number. It measures both the direction and strength of the linear correlation between two quantitative variables. -1 oO +1 Perfect Negative No Linear Perfect Positive Correlation Correlation Correlation Pearson’s r is always between -1 and +1. The closer the value is to ~1 or +1, the stronger the linear relationship. The sign (+ or -) indicates the direction. Step 3: Model the Trend with a Regression Line Ifa linear relationship exists, we can describe it with a single straight line. The regression line is the line that best captures the trend in our data. It is found by minimizing the overall distance from the line to every data point in the scatterplot. Residual The vertical distance between an actual data point and the regression line. Ordinary Least Squares (OLS) ‘The method used to find the regression line. It calculates the line for which the sum of the squared residuals is the smallest. Chocolate Consumption (ka/capita/year) How We Describe the Line: The Regression Equation Any straight line can be described by a simple equation. In statistics, this allows us to move from a visual trend to making precise predictions. Y=a+bx Y (V-hat): The Predicted Value of Y. ‘Any point on this line is a predicted i X: The value of your Independent Variable. ay The Slope or Regression Coefficient. at The Intercept. The change in predicted ‘The predicted value of predicted ¥ (°) for every Ywhen Xis 0. ‘one-unit increase in X. Using the Model to Make Predictions The regression equation is a powerful tool for forecasting. By plugging in a value for X, we can predict the most likely corresponding value of Y. Y = -5.63 + 2.80 * X What is the predicted number of Nobel winners for a country with a chocolate consumption (X) of 6 kg per capita? Y¥ = -5.63 + 2.80 * (6) Y=1117 Our model predicts about 11 Nobel winners per 10 million peop! ° 2 4 6 8 Cuma Chocolate Consumption (ka/capita/year) Nobel Prize Winners Step 4: Evaluate the Model with R-Squared (R?) R-Squared tells us how well our model fits the data. Specifically, it measures how much of the variation in our outcome variable (Y) can be explained by our predictor variable (X). R*: Explained Variance R? is the percentage of the variance R?is the percentage of the variance y in the dependent variable (Y) that is explained by the independent yo variable (X). Mariancelin) Variance in Chocolate gtbbal winners. R? = (Pearson's r)? Consumption ) (xX) R? is always a positive number between. O and 1. It tells you how much better the regression line is at predicting an outcome compared to just using the average of the outcome. The Most Important Warning in Statistics Correlation is NOT Causation Finding a strong relationship, even a predictive one, between two variables never proves that one causes the other. A regression analysis is a powerful descriptive tool, but it cannot, by itself, establish a causal link. Always consider alternative explanations. If Not Causation, Then What? A relationship between X and Y can be misleading. Here are three common alternative explanations. 1, Reverse Causality (Y > X) 2. Confounding Variable 3. Real-World Example (Spurious Relationship) Corruation Could the relationship be the other way Could a third, unmeasured factor be In countries, nigh corruption (2) might ‘around? Perhaps having a higher body _—_causing both? Genetics (Z) might cause both greater income inequality (X) ‘weight (Y) increases one's craving for influence both a person's appetite for and more politcal dissatisfaction (Y), chocolate 0X). chocolate (X) and their tendency to gain creating a correlation between X and ¥ woight (Y). without a direct causal ink A Second Warning: Beware of Influential Outliers Outliers—extreme data points that deviate from the general pattern—can have a massive impact on your results, especially in small datasets. They can dramatically change the slope of the regression line and the value of Pearson's r. Before After Body Weight Body Weight Chocolate Consumption Chocolate Consumption Actionable Advice Always investigate outliers. If you have good reason to suspect an outlier is the result of a measurement error, you might decide to remove it from your analysis. Putting It All Together: A Case Study Are taller U.S. presidents more popular? Let’s walk through a full analysis from start to finish using data from four recent U.S. presidents. We'll follow the four steps of our investigation. President Avg. Approval Rating (%) (Y) G.H.W. Bush 60.9% B. Clinton 55.1% G.W. Bush 49.4% B. Obama 47.9% The Analysis in Four Steps Step 1: Visualize Con oh 165009 8. clinton 18,561 8 ans 15,478 ort A visual inspection suggests a positive linear trend. Step 3: Model Y = -237.11 + 1.56 * Height For every 1 cm increase in height, a president's approval rating is predicted to increase by 1.56 points. Step 2: Measure Pearson's r = 0.73 This indicates a strong, positive linear relationship between height and approval rating in this sample. Step 4: Evaluate & Interpret R? = 0.53 ‘The president's height explains 53% of the variance in their approval ratings in this specific sample. However, this| conclusion is based on only four presidents. This small sample size requires extreme caution before making any broader inferences. The Story in Your Data: Your Key Lessons 7 * Start with a Visual: Always plot your data first to understand its © direction, strength, and form. L * Quantify with Purpose: Use Pearson’s r to get a precise measure of linear* strength and direction. Ww + Model for Prediction: Use a regression line (and its equation) to model the relationship and forecast outcomes. GD) « Evaluate Your Fit: Use R? to understand how much of the story your model actually tells. @ « Interpret with Wisdom: Never forget that correlation does not equal causation, and always be vigilant for influential outliers.

You might also like