Solved Exercises on Regression Analysis and Best-Fit Models in Algebra 2

Master regression analysis: linear, quadratic, and exponential regression techniques, correlation coefficients, and data modeling through these 5 detailed exercises.

Solution: Exercises 1 to 3
1 Linear regression
Exercise 1
Find the line of best fit for the data: (1, 3), (2, 5), (3, 7), (4, 9), (5, 11). Calculate the correlation coefficient and interpret the model.
Definition:

Linear regression: Statistical method to find the line that best fits a set of data points, minimizing the sum of squared residuals

Solution method:
  1. Plot the data points to visualize the relationship
  2. Calculate means of x and y values
  3. Compute the slope using the least squares formula
  4. Find the y-intercept using the point-slope form
  5. Calculate the correlation coefficient
  6. Interpret the strength and direction of the relationship
Data
(1,3), (2,5), (3,7), (4,9), (5,11)
Line
y = 2x + 1
Correlation
r = 1
Step 1: Calculate means

Mean of x: \(\bar{x} = \frac{1+2+3+4+5}{5} = \frac{15}{5} = 3\)

Mean of y: \(\bar{y} = \frac{3+5+7+9+11}{5} = \frac{35}{5} = 7\)

Step 2: Calculate the slope (m)

Using the least squares formula: \(m = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sum(x_i - \bar{x})^2}\)

For each point:

(1,3): \((1-3)(3-7) = (-2)(-4) = 8\), \((1-3)^2 = 4\)

(2,5): \((2-3)(5-7) = (-1)(-2) = 2\), \((2-3)^2 = 1\)

(3,7): \((3-3)(7-7) = (0)(0) = 0\), \((3-3)^2 = 0\)

(4,9): \((4-3)(9-7) = (1)(2) = 2\), \((4-3)^2 = 1\)

(5,11): \((5-3)(11-7) = (2)(4) = 8\), \((5-3)^2 = 4\)

Step 3: Sum the products and squares

\(\sum(x_i - \bar{x})(y_i - \bar{y}) = 8 + 2 + 0 + 2 + 8 = 20\)

\(\sum(x_i - \bar{x})^2 = 4 + 1 + 0 + 1 + 4 = 10\)

Step 4: Calculate the slope

\(m = \frac{20}{10} = 2\)

Step 5: Find the y-intercept

Using point-slope form: \(y - \bar{y} = m(x - \bar{x})\)

\(y - 7 = 2(x - 3)\)

\(y - 7 = 2x - 6\)

\(y = 2x + 1\)

Step 6: Calculate correlation coefficient

\(r = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum(x_i - \bar{x})^2 \sum(y_i - \bar{y})^2}}\)

\(\sum(y_i - \bar{y})^2 = (-4)^2 + (-2)^2 + 0^2 + 2^2 + 4^2 = 16 + 4 + 0 + 4 + 16 = 40\)

\(r = \frac{20}{\sqrt{10 \times 40}} = \frac{20}{\sqrt{400}} = \frac{20}{20} = 1\)

\(y = 2x + 1\), \(r = 1\)
Final answer:

The line of best fit is \(y = 2x + 1\) with a perfect positive correlation coefficient \(r = 1\).

Applied rules:

• Least squares method: Minimizes sum of squared residuals

• Correlation coefficient: \(r\) ranges from -1 to 1, indicating strength and direction

• Perfect correlation: \(r = ±1\) means all points lie exactly on the regression line

2 Quadratic regression
Exercise 2
Fit a quadratic model to the data: (0, 1), (1, 2), (2, 5), (3, 10), (4, 17). Determine if it's a better fit than linear.
Definition:

Quadratic regression: Finds the parabola that best fits data points using the form \(y = ax^2 + bx + c\)

Data
(0,1), (1,2), (2,5), (3,10), (4,17)
Model
y = x² + 1
R²
1.00
Step 1: Observe the pattern in the data

Looking at y-values: 1, 2, 5, 10, 17

First differences: 1, 3, 5, 7 (not constant)

Second differences: 2, 2, 2 (constant) → suggests quadratic relationship

Step 2: Set up the quadratic model

General form: \(y = ax^2 + bx + c\)

Using the point (0, 1): \(1 = a(0)^2 + b(0) + c\), so \(c = 1\)

Step 3: Use other points to find a and b

Using (1, 2): \(2 = a(1)^2 + b(1) + 1\), so \(a + b = 1\)

Using (2, 5): \(5 = a(2)^2 + b(2) + 1\), so \(4a + 2b = 4\)

Step 4: Solve the system of equations

From: \(a + b = 1\) and \(4a + 2b = 4\)

Multiply first equation by 2: \(2a + 2b = 2\)

Subtract from second: \(2a = 2\), so \(a = 1\)

Substitute: \(1 + b = 1\), so \(b = 0\)

Step 5: Write the quadratic model

\(y = x^2 + 0x + 1 = x^2 + 1\)

Step 6: Verify the model fits all points

(0,1): \(0^2 + 1 = 1\) ✓

(1,2): \(1^2 + 1 = 2\) ✓

(2,5): \(2^2 + 1 = 5\) ✓

(3,10): \(3^2 + 1 = 10\) ✓

(4,17): \(4^2 + 1 = 17\) ✓

Step 7: Compare with linear model

Linear model: \(y = 4x - 1\) (from least squares)

Linear R² ≈ 0.94, Quadratic R² = 1.00

Quadratic model is superior with perfect fit

\(y = x^2 + 1\)
Final answer:

The quadratic model \(y = x^2 + 1\) fits the data perfectly with \(R^2 = 1.00\), making it a better fit than any linear model.

Applied rules:

• Quadratic pattern: Constant second differences indicate quadratic relationship

• System of equations: Use known points to solve for unknown coefficients

• Model comparison: Higher R² indicates better fit

3 Exponential regression
Exercise 3
Fit an exponential model to the data: (0, 3), (1, 6), (2, 12), (3, 24), (4, 48). Verify it's the best model type.
Definition:

Exponential regression: Finds the exponential function that best fits data using the form \(y = a \cdot b^x\)

Data
(0,3), (1,6), (2,12), (3,24), (4,48)
Model
y = 3 · 2ˣ
R²
1.00
Step 1: Identify the pattern

Looking at y-values: 3, 6, 12, 24, 48

Ratio between consecutive terms: 6/3 = 2, 12/6 = 2, 24/12 = 2, 48/24 = 2

Constant ratio of 2 suggests exponential growth

Step 2: Use the initial value

When x = 0, y = 3, so the initial value a = 3

Step 3: Determine the growth factor

Since values double each time, the growth factor b = 2

Step 4: Write the exponential model

\(y = 3 \cdot 2^x\)

Step 5: Verify the model

(0,3): \(3 \cdot 2^0 = 3 \cdot 1 = 3\) ✓

(1,6): \(3 \cdot 2^1 = 3 \cdot 2 = 6\) ✓

(2,12): \(3 \cdot 2^2 = 3 \cdot 4 = 12\) ✓

(3,24): \(3 \cdot 2^3 = 3 \cdot 8 = 24\) ✓

(4,48): \(3 \cdot 2^4 = 3 \cdot 16 = 48\) ✓

Step 6: Compare with other models

Linear model: Would not capture the exponential growth pattern

Quadratic model: Would not show constant multiplicative growth

Exponential model captures the doubling behavior perfectly

Step 7: Interpret the parameters

a = 3: Initial value when x = 0

b = 2: Growth factor (doubling each unit increase in x)

\(y = 3 \cdot 2^x\)
Final answer:

The exponential model \(y = 3 \cdot 2^x\) fits the data perfectly with \(R^2 = 1.00\), confirming it's the appropriate model for this data.

Applied rules:

• Exponential pattern: Constant ratios between consecutive terms

• Initial value: Value when x = 0 gives coefficient a

• Growth factor: Ratio of consecutive y-values gives base b

Summary: Regression Analysis and Model Selection
\(y = mx + b\)
Linear Regression
Linear
\(y = mx + b\)
Constant rate of change
Quadratic
\(y = ax^2 + bx + c\)
Constant second differences
Exponential
\(y = a \cdot b^x\)
Constant ratio between terms
Key definitions:

Regression analysis: Statistical method for determining the relationship between variables by finding the best-fitting curve through data points

Line of best fit: The line that minimizes the sum of squared residuals (vertical distances from points to line)

Correlation coefficient (r): Measure of linear relationship strength ranging from -1 to 1, where |r| = 1 indicates perfect correlation

Coefficient of determination (R²): Proportion of variance in dependent variable explained by independent variable, ranges from 0 to 1

Residual: The difference between observed value and predicted value from the regression model

Linear regression: Fits a straight line to data using least squares method, appropriate for constant rate of change

Quadratic regression: Fits a parabola to data, appropriate for curved relationships with constant second differences

Exponential regression: Fits an exponential curve to data, appropriate for constant multiplicative growth/decay

Model selection methodology:
  1. Visual inspection: Plot data points to identify potential patterns
  2. Calculate differences: First differences for linear, second differences for quadratic
  3. Calculate ratios: For exponential patterns, check if consecutive terms have constant ratio
  4. Fit multiple models: Try linear, quadratic, and exponential regressions
  5. Compare goodness of fit: Use R² values or residual analysis
  6. Select best model: Choose model with highest R² and most appropriate pattern
  7. Validate model: Check if model makes sense in real-world context
Tip 1: Linear models have constant first differences between y-values.
Tip 2: Quadratic models have constant second differences between y-values.
Tip 3: Exponential models have constant ratios between consecutive y-values.
Tip 4: Higher R² values indicate better model fit.
Common errors: Fitting wrong model type, ignoring outliers, misinterpreting correlation as causation.
Exam preparation: Practice pattern recognition, memorize model characteristics, understand residuals.
Model identification criteria:

• Linear: r ≈ ±1, R² ≈ 1.0, constant first differences

• Quadratic: Curved pattern, constant second differences, R² > linear model

• Exponential: Constant ratios, exponential growth/decay pattern, R² > other models

• Model comparison: Choose model with highest R² and appropriate pattern

Solution: Exercises 4 to 5
4 Model comparison
Exercise 4
Given data (1, 2), (2, 5), (3, 10), (4, 17), (5, 26), determine which model (linear, quadratic, or exponential) best fits the data.
Definition:

Model comparison: Systematic process of evaluating multiple regression models to determine which best represents the data

Data
(1,2), (2,5), (3,10), (4,17), (5,26)
Linear
y = 6x - 5, R² ≈ 0.94
Quadratic
y = x² + 1, R² = 1.00
Step 1: Test for linear pattern (constant first differences)

y-values: 2, 5, 10, 17, 26

First differences: 5-2=3, 10-5=5, 17-10=7, 26-17=9

Differences: 3, 5, 7, 9 (not constant) → Not linear

Step 2: Test for quadratic pattern (constant second differences)

First differences: 3, 5, 7, 9

Second differences: 5-3=2, 7-5=2, 9-7=2

Second differences: 2, 2, 2 (constant) → Quadratic pattern

Step 3: Test for exponential pattern (constant ratios)

Ratios: 5/2=2.5, 10/5=2, 17/10=1.7, 26/17≈1.53

Ratios: 2.5, 2, 1.7, 1.53 (not constant) → Not exponential

Step 4: Fit quadratic model

General form: \(y = ax^2 + bx + c\)

Using points (1,2), (2,5), (3,10):

1: \(a + b + c = 2\)

2: \(4a + 2b + c = 5\)

3: \(9a + 3b + c = 10\)

Step 5: Solve the system

From equations 2-1: \(3a + b = 3\)

From equations 3-2: \(5a + b = 5\)

Subtracting: \(2a = 2\), so \(a = 1\)

Substituting: \(3(1) + b = 3\), so \(b = 0\)

Substituting: \(1 + 0 + c = 2\), so \(c = 1\)

Step 6: Verify the model

Quadratic model: \(y = x^2 + 1\)

(1,2): \(1^2 + 1 = 2\) ✓

(2,5): \(2^2 + 1 = 5\) ✓

(3,10): \(3^2 + 1 = 10\) ✓

(4,17): \(4^2 + 1 = 17\) ✓

(5,26): \(5^2 + 1 = 26\) ✓

Step 7: Compare R² values

Quadratic model: R² = 1.00 (perfect fit)

Linear model: R² ≈ 0.94

Quadratic model is superior

\(y = x^2 + 1\) (quadratic)
Final answer:

The quadratic model \(y = x^2 + 1\) best fits the data with perfect correlation (R² = 1.00).

Applied rules:

• Pattern recognition: Constant second differences indicate quadratic relationship

• System of equations: Use known points to solve for quadratic coefficients

• Model comparison: Higher R² indicates better fit

5 Real-world application
Exercise 5
A company's sales data over 5 years: Year 1: $100k, Year 2: $120k, Year 3: $144k, Year 4: $173k, Year 5: $207k. Fit an appropriate model and predict Year 6 sales.
Definition:

Business modeling: Using regression analysis to identify growth patterns and make predictions about future performance

Data
(1,100), (2,120), (3,144), (4,173), (5,207)
Model
y = 100 · (1.2)ˣ
Prediction
Year 6: $249k
Step 1: Analyze the data pattern

Sales: $100k, $120k, $144k, $173k, $207k

Check for constant ratios: 120/100 = 1.2, 144/120 = 1.2, 173/144 ≈ 1.20, 207/173 ≈ 1.20

Approximately constant ratio of 1.2 → Exponential growth pattern

Step 2: Identify the growth rate

Ratio ≈ 1.2 means 20% annual growth rate

Initial value: $100k (Year 1)

Step 3: Write the exponential model

Since Year 1 corresponds to x = 1, we have:

\(y = 100 \cdot (1.2)^x\) (where y is sales in thousands of dollars)

Step 4: Verify the model

Year 1: \(100 \cdot (1.2)^1 = 120\) (close to 100) - Actually this doesn't match!

Let's adjust: If y = a·b^x and (1,100), then 100 = a·b^1, so a·b = 100

Using ratio b = 1.2: a·1.2 = 100, so a = 83.33

Model: \(y = 83.33 \cdot (1.2)^x\)

Step 5: Verify adjusted model

Year 1: \(83.33 \cdot (1.2)^1 = 100\) ✓

Year 2: \(83.33 \cdot (1.2)^2 = 83.33 \cdot 1.44 = 120\) ✓

Year 3: \(83.33 \cdot (1.2)^3 = 83.33 \cdot 1.728 = 144\) ✓

Year 4: \(83.33 \cdot (1.2)^4 = 83.33 \cdot 2.074 = 173\) ✓

Year 5: \(83.33 \cdot (1.2)^5 = 83.33 \cdot 2.488 = 207\) ✓

Step 6: Predict Year 6 sales

Year 6 corresponds to x = 6:

\(y = 83.33 \cdot (1.2)^6\)

\(y = 83.33 \cdot 2.986 = 249\)

Step 7: Interpret the prediction

The model predicts sales of approximately $249,000 in Year 6

This represents continued 20% annual growth

\(y = 83.33 \cdot (1.2)^x\), Year 6: $249k
Final answer:

The exponential model is \(y = 83.33 \cdot (1.2)^x\) and predicted sales for Year 6 are approximately $249,000.

Applied rules:

• Business growth: Exponential models often represent compound growth

• Ratio identification: Constant ratios indicate exponential relationship

• Model validation: Verify model fits all known data points

Detailed Summary: Regression Analysis and Model Selection
\(R^2 = 1 - \frac{SS_{res}}{SS_{tot}}\)
Coefficient of Determination
Key definitions:

Regression analysis: A statistical method used to examine the relationship between one dependent variable and one or more independent variables by fitting a model to the data.

Least squares method: A technique that minimizes the sum of the squares of the residuals (differences between observed and predicted values) to find the best-fitting line.

Correlation coefficient (r): A measure of the strength and direction of a linear relationship between two variables, ranging from -1 to 1.

Coefficient of determination (R²): The proportion of the variance in the dependent variable that is predictable from the independent variable(s), ranging from 0 to 1.

Residual: The difference between an observed value and the value predicted by the regression model: residual = observed - predicted.

Linear regression: A regression model that assumes a linear relationship between variables, taking the form \(y = mx + b\).

Quadratic regression: A regression model that fits a parabolic curve to data, taking the form \(y = ax^2 + bx + c\).

Exponential regression: A regression model that fits an exponential curve to data, taking the form \(y = a \cdot b^x\).

Model selection: The process of choosing the most appropriate mathematical model to represent a given dataset based on pattern recognition and goodness-of-fit measures.

Complete regression methodology:
  1. Data visualization: Plot the data points to observe potential patterns
  2. Pattern recognition: Identify whether data appears linear, quadratic, exponential, or other
  3. Model selection: Choose appropriate regression model based on pattern
  4. Parameter estimation: Calculate model coefficients using appropriate method
  5. Goodness-of-fit assessment: Calculate R², examine residuals, and validate assumptions
  6. Model validation: Test model against additional data if available
  7. Prediction: Use validated model for forecasting or interpolation
Tip 1: Always plot your data first to visually assess the relationship.
Tip 2: Higher R² values generally indicate better model fit, but consider context.
Tip 3: Check residuals for patterns - random residuals indicate good fit.
Tip 4: Be cautious of extrapolation beyond the range of observed data.
Tip 5: Correlation does not imply causation - be careful with interpretations.
Tip 6: Consider outliers and their impact on the regression model.
Common error 1: Fitting a linear model to non-linear data without checking for patterns.
Common error 2: Overfitting by choosing overly complex models for simple relationships.
Common error 3: Ignoring the practical meaning of the model in real-world context.
Common error 4: Extrapolating too far beyond the range of observed data.
Complete model characteristics:

• Linear model: \(y = mx + b\), constant first differences, R² for linearity assessment

• Quadratic model: \(y = ax^2 + bx + c\), constant second differences, parabolic shape

• Exponential model: \(y = a \cdot b^x\), constant ratios between consecutive terms

• Power model: \(y = ax^b\), useful for relationships with variable exponents

• Logarithmic model: \(y = a + b \ln(x)\), useful for data that increases rapidly then levels off

• Model selection criterion: Choose model with highest R² that makes contextual sense

• Residual analysis: Plot residuals to check for patterns indicating model inadequacy

Visualization: Regression Model Comparison
Exercise 6: Model Visualization
Compare regression models for the data set:
(1, 2), (2, 5), (3, 10), (4, 17), (5, 26)
\(f_1(x) = 6x - 5\) (Linear)
\(f_2(x) = x^2 + 1\) (Quadratic)
\(f_3(x) = 2 \cdot 1.8^x\) (Exponential)

Analysis: The chart compares how different models fit the same data set.

  • \(f_1(x) = 6x - 5\): Linear model with R² ≈ 0.94
  • \(f_2(x) = x^2 + 1\): Quadratic model with R² = 1.00 (perfect fit)
  • \(f_3(x) = 2 \cdot 1.8^x\): Exponential model (less appropriate)

Questions & Answers

Question: How do I know which type of regression model to use for a given data set? What are the visual cues?

Answer: Here are the key visual and computational cues for model selection:

Linear model (y = mx + b):

  • Data points roughly form a straight line when plotted
  • First differences between consecutive y-values are approximately constant
  • Scatter plot shows consistent upward or downward trend

Quadratic model (y = ax² + bx + c):

  • Data points form a U-shape or inverted U-shape (parabola)
  • Second differences between consecutive y-values are approximately constant
  • Shows a turning point where trend changes direction

Exponential model (y = a·bˣ):

  • Data shows rapid increase or decrease that accelerates over time
  • Ratios between consecutive y-values are approximately constant
  • Curve that gets steeper as x increases (growth) or flatter (decay)

Always plot your data first and look for these visual patterns before doing calculations!

Question: What's the difference between correlation coefficient (r) and coefficient of determination (R²)? When do I use each?

Answer: These are related but distinct measures:

Correlation coefficient (r):

  • Measures strength and direction of linear relationship
  • Range: -1 ≤ r ≤ 1
  • Positive r: positive correlation (as x increases, y tends to increase)
  • Negative r: negative correlation (as x increases, y tends to decrease)
  • Close to ±1: strong linear relationship
  • Close to 0: weak linear relationship

Coefficient of determination (R²):

  • Measures proportion of variance in y explained by x
  • Range: 0 ≤ R² ≤ 1
  • Always positive (even for negative correlations)
  • Represents "goodness of fit" for any model type
  • R² = 0.85 means 85% of y variation is explained by x

Relationship: R² = r² (for linear regression only)

Use r for linear relationships to understand direction and strength. Use R² for any model to assess how well it explains the data.

Question: Can a data set have multiple good models? How do I choose between them?

Answer: Yes, sometimes multiple models can fit data reasonably well! Here's how to choose:

  1. Compare R² values: Choose the model with the highest R²
  2. Consider simplicity: Prefer simpler models (Occam's Razor)
  3. Check residuals: Better models have randomly distributed residuals
  4. Evaluate context: Which model makes more sense for the real-world situation?
  5. Test extrapolation: See how models behave outside the data range

Example: If both linear and quadratic models have high R² values, but the context suggests a turning point (like maximum profit), the quadratic model might be more appropriate even if R² is only slightly higher.

Question: What should I do if my data doesn't seem to fit any of the standard models?

Answer: This happens frequently with real-world data! Consider these approaches:

Transform the data:

  • Take logarithms to linearize exponential relationships
  • Square root transformation for quadratic-like patterns
  • Reciprocal transformation for certain rational relationships

Use piecewise functions:

  • Different models for different intervals of x
  • Useful when behavior changes at certain points

Consider other models:

  • Power functions: \(y = ax^b\)
  • Logarithmic functions: \(y = a + b\ln(x)\)
  • Rational functions: \(y = \frac{ax + b}{cx + d}\)

Sometimes the best approach is to acknowledge that no simple model perfectly represents the data and use the best available approximation while noting its limitations.