CSC212 ยท 2081 ยท 5 marks
What is regression analysis? Fit a second order polynomial for the following data values.
What is regression analysis? Fit a second order polynomial for the following data values.
$$\begin{array}{c|ccccc} x & 2 & 4 & 6 & 8 & 10 \ \hline y & 1.4 & 2.0 & 2.4 & 2.6 & 2.8 \end{array}$$
[5]
Regression Analysis and Second Order Polynomial Fitting
What is Regression Analysis?
Regression analysis is a statistical technique used to determine the best-fit mathematical relationship between a dependent variable and one or more independent variables. Unlike interpolation (which forces the curve through every data point), regression minimizes the total squared error between the observed data and the fitted curve (least squares principle). It is widely used for prediction and trend estimation.
Given Data
$$ \begin{array}{c|ccccc} x & 2 & 4 & 6 & 8 & 10\ \hline y & 1.4 & 2.0 & 2.4 & 2.6 & 2.8 \end{array} $$
$n = 5$. Fit $y = a_0 + a_1 x + a_2 x^2$.
Step 1: Summation Table
| $x$ | $y$ | $x^2$ | $x^3$ | $x^4$ | $xy$ | $x^2y$ |
|---|---|---|---|---|---|---|
| 2 | 1.4 | 4 | 8 | 16 | 2.8 | 5.6 |
| 4 | 2.0 | 16 | 64 | 256 | 8.0 | 32.0 |
| 6 | 2.4 | 36 | 216 | 1296 | 14.4 | 86.4 |
| 8 | 2.6 | 64 | 512 | 4096 | 20.8 | 166.4 |
| 10 | 2.8 | 100 | 1000 | 10000 | 28.0 | 280.0 |
| $\sum$ | 11.2 | 220 | 1800 | 15664 | 74.0 | 570.4 |
$\sum x = 30$, $\sum y = 11.2$, $\sum x^2 = 220$, $\sum x^3 = 1800$, $\sum x^4 = 15664$, $\sum xy = 74.0$, $\sum x^2y = 570.4$
(Check $\sum x^4$: $16+256+1296+4096+10000 = 15664$ โ)
Step 2: Normal Equations
$$5a_0 + 30a_1 + 220a_2 = 11.2 \quad (1)$$ $$30a_0 + 220a_1 + 1800a_2 = 74.0 \quad (2)$$ $$220a_0 + 1800a_1 + 15664a_2 = 570.4 \quad (3)$$
Solution
$(2) - 6\times(1)$: $$40a_1 + 480a_2 = 6.8 \quad (4)$$
$(3) - 44\times(1)$: $$480a_1 + 5984a_2 = 77.6 \quad (5)$$
$(5) - 12\times(4)$: $12\times(4)$ gives $480a_1 + 5760a_2 = 81.6$. $$(5984 - 5760)a_2 = 77.6 - 81.6$$ $$224a_2 = -4.0 \implies a_2 = -0.017857$$
From (4): $$40a_1 = 6.8 - 480(-0.017857) = 6.8 + 8.5714 = 15.3714$$ $$a_1 = 0.38429$$
From (1): $$5a_0 = 11.2 - 30(0.38429) - 220(-0.017857)$$ $$= 11.2 - 11.5286 + 3.9286 = 3.6000$$ $$a_0 = 0.7200$$
(Using the more precise $a_1=0.384286$ and $a_2=-0.0178571$ gives $a_0 = 0.72$; rounding earlier would give $0.7188$.)
Result
$$\boxed{y = 0.72 + 0.3843,x - 0.01786,x^2}$$
Rounding during the intermediate steps would give $a_0 \approx 0.7188$, $a_1 \approx 0.3848$ and $a_2 \approx -0.0179$; the more accurate value is $a_0 \approx 0.72$, and the fit is essentially the same.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.