Comprehensive Notes on Simple Linear Regression and Correlation
Introduction to Simple Linear Regression and Correlation
This study explores the relationship between two variables using two primary methods:
1. Regression analysis.
2. Computing the correlation coefficient.
Bivariate Data Sets: These are data sets involving two variables that are measured simultaneously to explore their relationships.
The Regression Model
Definition: A regression model is a mathematical equation that describes the relationship between two or more variables. It is used to evaluate the magnitude of change in one variable resulting from a change in another variable and to predict (estimate) the value of one variable for a given value of another.
General Equation:
: Parameter estimates or coefficients.
: The y-intercept (constant).
: The error term.
Linear vs. Nonlinear Models:
A simple regression model providing a straight-line relationship is a linear regression model.
If the relationship is not a straight line, it is a nonlinear regression model.
Simple Linear Regression Equation:
: Independent (explanatory) variable.
: Dependent (response) variable.
: The y-intercept.
: The slope of the regression line.
Simple Linear Regression Objectives
The exploration of linear relationships focuses on two main issues:
1. Finding the Equation: Determining the linear regression equation (the straight line that best describes the relationship). This line is then used for linear estimation to predict for a given .
2. Measuring Strength: Determining the strength of the linear relationship using the linear correlation coefficient.
Scatter Diagrams
A scatter diagram (also known as a scatter plot or scatter graph) is the first step in exploring bivariate data. It involves plotting variables on a graph to detect potential relationships.
Example Case Study: Energy Consumption vs. Household Income.
Household Income () in thousands of rand.
Energy Consumption () in thousands of Btu.
Data points for 8 households:
(20, 2), (72, 7), (44, 5), (96, 10), (60, 7), (32, 3), (90, 9), (52, 5).
The Least Squares Principle
Regression analysis aims to find the line that best fits the points in a scatter diagram, providing the best possible description of the relationship.
Least Squares Regression Line: This is the line that best fits the plotted points based on the least squares principle.
Least Squares Principle Rule: The "best" fit line is the one that minimizes the sum of the squares of errors (SSE).
Calculation of the Least Squares Regression Line
Equation to be fitted:
: The fitted value (the value on the line, distinct from the observed value).
: The error (residual).
Computation Formulas:
Slope ():
Y-Intercept ():
Practical Example: Income and Energy Consumption
Data Summary ():
Intermediate Calculations:
Model Parameters:
Estimated Regression Line:
Prediction Example:
For a household with an income of R35,000 ():
Estimated consumption is approximately .
Limitations and Practical Cautions
Non-linear relationships: Lack of a linear relationship does not imply no relationship exists; variables might be related non-linearly.
Practical Validity: Variables should only be explored if a practical relationship is plausible. Spurious correlations (e.g., number of vehicles in New York vs. divorces in South Africa) have no practical value despite what the data might suggest.
Standard Error of the Estimate
Definition (): A measure of the standard deviation of the errors in the regression model. It represents the average deviation of the observed values from the predicted values.
Random Error (): Defined as the difference between actual and estimated .
The sum of errors () is always zero.
Formula for :
Accuracy: A smaller standard error indicates higher prediction accuracy.
Calculation for Energy Example:
Residuals
A residual is the vertical distance between an actual data point and the regression line.
If the point is above the line, the residual is positive.
If the point is below the line, the residual is negative.
Coefficient of Determination ()
Definition: A statistical measure that determines the proportion of variance in the dependent variable explained by the independent variable in the model.
Range: .
Formulas:
Coefficient of Alienation: Calculated as , representing the unexplained variance.
Calculation for Energy Example:
Result: of the variation in energy consumption is explained by income; the remaining is due to other factors.
Linear Correlation Coefficient ()
Definition: Measures the strength and direction of the linear association between two variables and how closely points cluster around the regression line.
Range: .
Higher clustering near the line leads to approaching or .
Lower clustering leads to approaching .
Rules of Thumb for Interpretation:
: Very high correlation.
: High correlation.
: Moderate correlation.
: Low correlation.
: Little, if any, correlation.
Pearson’s Linear Correlation Coefficient Formula:
Spearman’s Rank Order Correlation ()
Definition: Measures the relationship between the ranks of the data rather than the raw values.
Range: .
Ranking Method:
1. Rank values in increasing/decreasing order to get .
2. Rank values to get .
3. Tied observations: Assign the mean of the ranks they would have occupied.
Formula using Ranks ( and ):
Simplified Formula for Rank Difference ():
where .
Comparison in Energy Example:
both methods result in . Note that if there are many tied observations, results may differ between formulas.