Bivariate Data Analysis: Correlation and Least-Squares Regression
Bivariate Data and Scatterplots
Definition of Bivariate Data:
Bivariate data consist of pairs of ordered values, commonly denoted as , measured on the same individual or experimental unit.
It involves two distinct variables: an explanatory variable and an outcome variable.
The Scatterplot:
The fundamental graphical tool utilized to examine and display bivariate data is the scatterplot.
Each point represents an individual observation plotted at coordinates corresponding to its values for both variables.
The explanatory variable () is plotted along the horizontal axis, while the response or outcome variable () is plotted along the vertical axis.
Real Estate Example (Sue Bays Realty Sample):
A real estate agent studied the relationship between house size in square feet and final selling price in thousands of dollars () for a sample of houses located in a suburban Denver neighborhood.
Observed Sample Dataset (Table 4.1):
House 1: Size = , Selling Price = ()
House 2: Size = , Selling Price = ()
House 3: Size = , Selling Price = ()
House 4: Size = , Selling Price = ()
House 5: Size = , Selling Price = ()
House 6: Size = , Selling Price = ()
House 7: Size = , Selling Price = ()
House 8: Size = , Selling Price = ()
Visual Patterns in the Scatterplot:
Larger sizes tend to pair with larger prices, and smaller sizes tend to pair with smaller prices, representing a positive association.
The points cluster around a straight trajectory from the lower left to the upper right, demonstrating a linear relationship between size and selling price.

Types of Association in Scatterplots
Forms of Association (Figure 4.2):
Positive Linear Association: Points cluster tightly along an upward-sloping straight line from bottom-left to top-right. As the explanatory variable increases, the response variable tends to increase.
Negative Linear Association: Points cluster tightly along a downward-sloping straight line from top-left to bottom-right. As the explanatory variable increases, the response variable tends to decrease.
Weak Linear Association: Points exhibit a broad, diffuse cloud with minimal alignment along a line, signifying a low-strength linear connection.
Positive Nonlinear Association: Points form an upward-trending curve where the rate of change is not constant.
Negative Nonlinear Association: Points form a downward-trending curve where the rate of change decreases or changes nonlinearly.

Limitation of Visual Scale (Figure 4.3):
Visual assessment of linear strength can be deceptive because it depends directly on the chosen scale of the plot axes.
Two scatterplots displaying the exact same dataset can convey conflicting impressions if the vertical axis scale is stretched or compressed.
For instance, scaling the -axis from to yields a wider scatter pattern, whereas scaling from to compresses the points vertically, creating the illusion of a tighter, stronger linear relationship.
Consequently, an objective numerical measure independent of graphical scaling is mandatory to evaluate linear relationship strength.

The Linear Correlation Coefficient
Definition and Mathematical Formulation:
The sample correlation coefficient () quantitatively measures the strength and direction of the linear relationship between two quantitative variables.
It computes the average product of standardized scores (-scores) for the two variables across all pairs:
Mathematical Properties of :
Bounded Range: The value always lies between and inclusive:
Scale and Unit Invariance: The value of is dimensionless and does not depend on the units in which either or is measured.
Symmetry: Switching the explanatory variable and the response variable does not alter the correlation coefficient ().
Strict Linearity Measure: The coefficient measures only the strength and direction of a straight-line (linear) relationship; it does not properly measure curved or nonlinear patterns.
Non-Resistance to Outliers: The value of is sensitive to outliers and extreme values; a single aberrant observation can substantially increase or decrease .
Correlation vs. Causation Principle: A high correlation does not imply causation. A linear association between two variables does not prove that changes in one variable cause changes in the other.
Step-by-Step Manual Calculation for the Denver House Sample:
Summary Statistics:
Sample size:
Mean of size:
Standard deviation of size:
Mean of price:
Standard deviation of price:
Standardized Products per House:
House 1 (, ):
* House 2 (, ):
* House 3 (, ):
* House 4 (, ):
* House 5 (, ):
* House 6 (, ):
* House 7 (, ):
* House 8 (, ):
Summation and Coefficient Result:
Computational Implementation in R:
Entering vector coordinates and computing correlation directly:
Vector definition for house sizes:
x = c(2521, 2555, 2735, 2846, 3028, 3049, 3198, 3198)Vector definition for house prices:
y = c(400, 426, 428, 435, 469, 475, 488, 455)Correlation computation command:
cor(x, y)Console output value:
0.9005918
Additional Dataset Practice Exercise:
Dataset values: ,
Provided parameters: , , , ,
Step-by-step substitution into correlation formula:
Least-Squares Regression
Variable Roles in Regression:
Explanatory Variable (): Also known as the predictor or independent variable, used to explain or forecast variations in the response.
Outcome Variable (): Also known as the response or dependent variable, representing the target outcome being modeled.
In the real estate context, Size is the explanatory variable () and Selling Price is the outcome variable ().
Least-Squares Estimation (LSE) Criterion:
A regression line models the trend of the data points.
Vertical distances between observed points and the line are residuals.
The least-squares regression line minimizes the sum of squared vertical distances from the individual observed data points to the fitted line.
A line with smaller overall vertical distances fits the data better than a line with large vertical distances.

Mathematical Equation of the Regression Line:
The least-squares regression equation for predicting from is:
Slope ():
-Intercept ():
Numerical Computation for the Denver House Sample:
Parameter inputs: , , , ,
Slope computation:
Intercept computation:
Final regression line equation:
/

Linear Model Computation in R:
Syntax to obtain coefficients:
Command:
coef(lm(y ~ x))Output values:
(Intercept) = 160.19391458,x = 0.09919795Syntax to plot the regression line on the scatterplot:
Command:
plot(x, y)Command:
abline(lm(y ~ x))
Prediction and Interpretation of Regression Elements
Making Predictions ():
The least-squares regression line predicts values of the outcome variable when given a specific value of the explanatory variable.
Interpolation vs. Extrapolation: Predictions are valid only within the observed domain of the explanatory variable data (). Predicting values outside this range constitutes extrapolation and can be unreliable.
Computation: Substituting an explanatory value into the regression formula produces the predicted value ().
Example Prediction: For a house size of :
Point of Averages Property: The least-squares regression line always passes through the point of averages (, ). Substituting produces .
Interpretation of the Predicted Value ():
For any specified value of , the predicted value provides an estimate of the average outcome (-value) across all individuals or units with that specific -value.
Example Interpretation for House Size of :
The estimated average price for all houses measuring is , equivalent to .
Interpretation of the Slope ():
The slope indicates the expected average change in the outcome variable for every -unit increase in the explanatory variable.
Given :
For every (square foot) increase in the size of the house, the selling price increases on average by ().
Multi-Unit Change Example:
For an increase of (such as expanding house size from to ):
* The predicted selling price increases by () on average.
Interpretation of the -Intercept ():
The -intercept represents the estimated value of when the explanatory variable .
In many practical applications, interpreting is not meaningful because lies entirely outside the range of observed data (for example, a house of size has no physical reality).