Exponential Linear Regression 648F84
1. **Problem Statement:** We are given data points for $x$ and $y$ and need to find the best fitting exponential function $f(x)$ and linear function $g(x)$ using regression. Then, determine which fits better.
2. **Exponential Regression:** The model is $f(x) = ab^x$.
- Taking natural logs: $\ln y = \ln a + x \ln b$.
- We perform linear regression on $(x, \ln y)$ to find $\ln a$ and $\ln b$.
3. **Data:**
$x = [1,2,3,4,5,6]$
$y = [1093,1565,2402,3650,5281,7791]$
4. **Calculate $\ln y$:**
$\ln y = [\ln 1093, \ln 1565, \ln 2402, \ln 3650, \ln 5281, \ln 7791]$
$\approx [6.99756, 7.35614, 7.78411, 8.20124, 8.57115, 8.96017]$
5. **Linear regression on $(x, \ln y)$:**
Calculate means:
$\bar{x} = \frac{1+2+3+4+5+6}{6} = 3.5$
$\overline{\ln y} = \frac{6.99756 + 7.35614 + 7.78411 + 8.20124 + 8.57115 + 8.96017}{6} \approx 7.81173$
Calculate slope $m$ and intercept $c$:
$$m = \frac{\sum (x_i - \bar{x})(\ln y_i - \overline{\ln y})}{\sum (x_i - \bar{x})^2}$$
$$c = \overline{\ln y} - m \bar{x}$$
Compute numerator:
$(1-3.5)(6.99756-7.81173) + (2-3.5)(7.35614-7.81173) + (3-3.5)(7.78411-7.81173) + (4-3.5)(8.20124-7.81173) + (5-3.5)(8.57115-7.81173) + (6-3.5)(8.96017-7.81173)$
$= (-2.5)(-0.81417) + (-1.5)(-0.45559) + (-0.5)(-0.02762) + (0.5)(0.38951) + (1.5)(0.75942) + (2.5)(1.14844)$
$= 2.03543 + 0.68339 + 0.01381 + 0.19476 + 1.13913 + 2.87110 = 6.93762$
Denominator:
$(1-3.5)^2 + (2-3.5)^2 + (3-3.5)^2 + (4-3.5)^2 + (5-3.5)^2 + (6-3.5)^2$
$= 6.25 + 2.25 + 0.25 + 0.25 + 2.25 + 6.25 = 17.5$
So,
$m = \frac{6.93762}{17.5} = 0.39644$
$c = 7.81173 - 0.39644 \times 3.5 = 7.81173 - 1.38754 = 6.42419$
6. **Find $a$ and $b$:**
$a = e^c = e^{6.42419} \approx 616.44$
$b = e^m = e^{0.39644} \approx 1.48653$
7. **Exponential function:**
$$f(x) = 616.44 \times 1.48653^x$$
8. **Linear Regression:** The model is $g(x) = mx + b$.
Calculate means:
$\bar{x} = 3.5$
$\bar{y} = \frac{1093 + 1565 + 2402 + 3650 + 5281 + 7791}{6} = \frac{21782}{6} = 3630.33$
Calculate slope $m$:
Numerator:
$(1-3.5)(1093-3630.33) + (2-3.5)(1565-3630.33) + (3-3.5)(2402-3630.33) + (4-3.5)(3650-3630.33) + (5-3.5)(5281-3630.33) + (6-3.5)(7791-3630.33)$
$= (-2.5)(-2537.33) + (-1.5)(-2065.33) + (-0.5)(-1228.33) + (0.5)(19.67) + (1.5)(1650.67) + (2.5)(4160.67)$
$= 6343.33 + 3098.00 + 614.17 + 9.83 + 2476.00 + 10401.67 = 23342.99$
Denominator (same as before): 17.5
So,
$m = \frac{23342.99}{17.5} = 1333.03$
Intercept $b$:
$b = \bar{y} - m \bar{x} = 3630.33 - 1333.03 \times 3.5 = 3630.33 - 4665.61 = -1035.28$
9. **Linear function:**
$$g(x) = 1333.03x - 1035.28$$
10. **Which fits better?**
- Exponential regression fits growth pattern better for this data (increasing rate).
- Linear regression has negative intercept and less natural fit.
- Given the data's rapid increase, the exponential model is better.
**Final answers:**
$$f(x) = 616.44000 \times 1.48653^x$$
$$g(x) = 1333.03000x - 1035.28000$$