Introduction to Regression Analysis: Predictions, Equations, and Error

Introduction for Regression Analysis

  • Context within the Course: Regression is the follow-up topic to Correlation (Chapter 13). It is considered one of the more challenging topics to adapt to an online format because the presentation often varies based on student questions and feedback.
  • Prerequisites for Success:
    • Slope-Intercept Form: Students must have a solid grasp of the algebraic concept of a line (y=mx+by = mx + b). Reviewing this for 10-20 minutes is essential to avoid wasting time during the 90-minute to two-hour regression lecture.
    • Concept of Deviations: A refresher of deviations from Chapter 4 is highly recommended, as regression concepts (like residuals) are analogous to deviations from the mean.
  • The Example Case: This lecture continues the example used in Chapter 13: the relationship between playing violent video games (Variable XX) and aggressive behavior (Variable YY, measured in fights per week).

The Purpose and Logic of Regression

  • Prediction: The primary purpose of regression is to predict specific values of YY based on given values of XX. While correlation tells us the strength and direction of a relationship, regression allows us to make concrete estimates.
  • The Best Fit Line (Regression Line):
    • In a scatter plot, we can visualize a line running through the points.
    • If points go up and to the right, there is a positive correlation; if they go down and to the right, it is a negative correlation. If the points are a "blob," there is no correlation.
    • Regression uses a precise mathematical procedure to find the single best line that fits the data better than any other possible line. This is also known as the "best fit line."
  • Predicting Heights (YY): On a graph, the regression line allows us to find an XX value on the horizontal axis, look up to the height of the line at that point, and find the corresponding prediced YY value on the vertical axis.

Regression Notation and Symbols

  • Y-Hat (y^\hat{y}): Predicted values of YY are given the symbol y^\hat{y}. It is read aloud as "y-hat."
    • Metaphor: Think of the symbol as a "wizard's hat." This indicates the value is a prediction (magic/foresight) rather than an actual observed data point.
  • Algebra vs. Statistics Notation:
    • Algebra: y=mx+by = mx + b (where mm = slope and bb = intercept).
    • Statistics (Regression): y^=bX+a\hat{y} = bX + a.
    • In stats, bb is the symbol for slope (changing from mm).
    • In stats, aa is the symbol for the intercept (changing from bb).
    • Note of Confusion: The letter bb represents the intercept in algebra but represents the slope in regression statistics.
  • Variables vs. Constants:
    • XX and y^\hat{y} are variables. You can plug in any XX to get a corresponding y^\hat{y}.
    • bb (slope) and aa (intercept) are constants. For a specific dataset, these numbers are calculated once and do not change for that problem.

Solving for Slope and Intercept

To find the equation of the regression line, you use data already calculated for correlation (MxM_x, MyM_y, SSxSS_x, SSySS_y, and SPSP).

  • Formula for Slope (bb):Slope (b)=SPSSx\text{Slope } (b) = \frac{SP}{SS_x}
  • Formula for Intercept (aa):Intercept (a)=My(b×Mx)\text{Intercept } (a) = M_y - (b \times M_x)
    • Restriction: You must always solve for slope (bb) first because it is a required component of the intercept (aa) formula.
Example Calculation (Video Games and Aggression)

Using values from the Chapter 13 example:

  • Mx=6M_x = 6 (Average hours of games per week)
  • My=4M_y = 4 (Average fights per week)
  • SSx=64SS_x = 64
  • SSy=16SS_y = 16
  • SP=+28SP = +28
  • r=0.875r = 0.875
  1. Calculate bb:b=2864=0.44b = \frac{28}{64} = 0.44
  2. Calculate aa:a=4(0.44×6)a = 4 - (0.44 \times 6)a=42.64=1.36a = 4 - 2.64 = 1.36
  3. The Regression Equation:y^=0.44X+1.36\hat{y} = 0.44X + 1.36

Interpreting Slope and Intercept

  • General Interpretation of Slope (bb): It tells you how many units of increase occur in the predicted YY (y^\hat{y}) for each one-unit increase in XX.
    • Example Case: For every one additional hour of violent video games played per week (XX), we predict the child will get into 0.440.44 more fights per week (y^\hat{y}).
  • General Interpretation of Intercept (aa): It tells you the predicted value of YY when X=0X = 0.
    • Example Case: If a child plays zero hours of violent video games per week, we predict they will get into 1.361.36 fights per week. (This accounts for other factors that might cause aggression besides games).

Using the Equation to Generate Predictions

We plug actual observed XX values into the equation to see how well the line predicts the actual YY values (fights).

  • Child 1: X=0y^=0.44(0)+1.36=1.36X = 0 \rightarrow \hat{y} = 0.44(0) + 1.36 = 1.36 (Actual y=2y = 2)
  • Child 2: X=10y^=0.44(10)+1.36=5.76X = 10 \rightarrow \hat{y} = 0.44(10) + 1.36 = 5.76 (Actual y=6y = 6)
  • Child 3: X=4y^=0.44(4)+1.36=3.12X = 4 \rightarrow \hat{y} = 0.44(4) + 1.36 = 3.12 (Actual y=2y = 2)
  • Child 4: X=8y^=0.44(8)+1.36=4.88X = 8 \rightarrow \hat{y} = 0.44(8) + 1.36 = 4.88 (Actual y=4y = 4)
  • Child 5: X=8y^=0.44(8)+1.36=4.88X = 8 \rightarrow \hat{y} = 0.44(8) + 1.36 = 4.88 (Actual y=6y = 6)

Note: Prediction models are rarely perfect. The value of regression is being able to predict outcomes for a new child (X=7X = 7) even when we don't have their fight data (YY).

Residuals (Error of Prediction)

  • Definition: A residual is the difference between an actual observed value (yy) and a predicted value (y^\hat{y}).
  • Formula:Residual=yy^\text{Residual} = y - \hat{y}
  • Interpretation of the Sign:
    • Positive Residual: The person scored higher than the prediction. The point is above the line.
    • Negative Residual: The person scored lower than the prediction. The point is below the line.
  • Mathematical Property: The sum of all residuals in a dataset is always zero ((yy^)=0\sum(y - \hat{y}) = 0), much like the sum of deviations from the mean.
  • Visual Representation: Residuals are the vertical distances between the points on a scatter plot and the regression line.

Defining the "Best Fit"

  • Least Squares Criterion: The regression line is called the "best fit" because it minimizes the total vertical distance between the line and all data points.
  • Sum of Squared Residuals (SSresidualSS_{residual}): Because residuals add up to zero, we square them to make them all positive before summing them.
    • The regression line is the line that results in the smallest possible SSresidualSS_{residual}.
    • If you tweak the slope or intercept even slightly, the SSresidualSS_{residual} will increase.

Standard Error of the Estimate

  • Definition: The standard error of the estimate is the "average residual." It measures the average vertical distance between the actual data points and the regression line.
  • Analogy: It is to the regression line what standard deviation is to the mean.
  • Notation: In this course, we use the abbreviation "Standard Error of the Estimate."
  • Formula:Standard Error of the Estimate=SSresidualn2\text{Standard Error of the Estimate} = \sqrt{\frac{SS_{residual}}{n - 2}}
    • Note on Degrees of Freedom: We use n2n - 2 because we are dealing with two variables (XX and YY).
  • Computational Shortcut for SSresidualSS_{residual}:SSresidual=(1r2)×SSySS_{residual} = (1 - r^2) \times SS_y
    • Using the example: SSresidual=(10.8752)×16=(10.766)×16=0.234×16=3.744SS_{residual} = (1 - 0.875^2) \times 16 = (1 - 0.766) \times 16 = 0.234 \times 16 = 3.744
  • Final Calculation for Example:Standard Error=3.74452=3.7443=1.25=1.12\text{Standard Error} = \sqrt{\frac{3.744}{5 - 2}} = \sqrt{\frac{3.744}{3}} = \sqrt{1.25} = 1.12
    • Meaning: On average, our predictions of fights per week are off by 1.121.12 fights.

Relationship Between Correlation and Standard Error

  • Inverse Relationship: As the correlation (rr) gets stronger (closer to 1.01.0 or 1.0-1.0), the standard error of the estimate gets smaller.
  • High Correlation = Small Error: If education and income are highly correlated, knowing education allows for very accurate (low error) predictions of income.
  • Low Correlation = High Error: If IQ and shoe size have a near-zero correlation, using IQ to predict shoe size will result in massive errors, performing no better than random guessing.