Statistics · real student question

Find the quadratic regression equation for the data points (10, 2.9), (20, 4.0) and (30, 4.9), and compute the coefficient of determination R squared. Show the derivation.

Question

For the data

(10,2.9),(20,4.0),(30,4.9)(10,\,2.9),\qquad(20,\,4.0),\qquad(30,\,4.9)

find the quadratic regression equation y=ax2+bx+cy=ax^2+bx+c and the coefficient of determination R2R^2. Show the derivation.

Step-by-step solution

  1. Realise first that no least-squares machinery is needed. A quadratic has three free parameters aa, bb, cc, and there are exactly three data points. Three points with distinct xx-values determine a unique parabola, so the least-squares fit is the interpolating parabola: the minimum possible sum of squared residuals is 00, and it is attained. This is why the whole problem reduces to solving a 3×33\times3 linear system.

  2. Substitute each point into y=ax2+bx+cy=ax^2+bx+c.

    100a+10b+c=2.9(1)100a+10b+c=2.9\qquad(1)

    400a+20b+c=4.0(2)400a+20b+c=4.0\qquad(2)

    900a+30b+c=4.9(3)900a+30b+c=4.9\qquad(3)

  3. Eliminate cc by subtracting consecutive equations. Differencing removes cc immediately because its coefficient is the same in all three:

    (2)(1):300a+10b=1.1    30a+b=0.11(A)(2)-(1):\quad300a+10b=1.1\;\Longrightarrow\;30a+b=0.11\qquad(A)

    (3)(2):500a+10b=0.9    50a+b=0.09(B)(3)-(2):\quad500a+10b=0.9\;\Longrightarrow\;50a+b=0.09\qquad(B)

  4. Difference once more to find aa, then back-substitute.

    (B)(A):20a=0.02    a=0.001(B)-(A):\quad20a=-0.02\;\Longrightarrow\;a=-0.001

    from (A):  30(0.001)+b=0.11    b=0.14\text{from }(A):\;30(-0.001)+b=0.11\;\Longrightarrow\;b=0.14

    from (1):  0.1+1.4+c=2.9    c=1.6\text{from }(1):\;-0.1+1.4+c=2.9\;\Longrightarrow\;c=1.6

    The regression equation is

    y=0.001x2+0.14x+1.6y=-0.001x^2+0.14x+1.6

    The double differencing is the second difference of the data (0.91.1=0.20.9-1.1=-0.2 per step of 1010), which is why aa came out negative: the increments are shrinking, so the curve bends downward.

  5. Compute the fitted values and the residual sum of squares.

    y^(10)=0.1+1.4+1.6=2.9,y^(20)=0.4+2.8+1.6=4.0,y^(30)=0.9+4.2+1.6=4.9\hat y(10)=-0.1+1.4+1.6=2.9,\quad \hat y(20)=-0.4+2.8+1.6=4.0,\quad \hat y(30)=-0.9+4.2+1.6=4.9

    Every fitted value equals its observed value, so

    SSres=(yiy^i)2=0SS_{\text{res}}=\sum(y_i-\hat y_i)^2=0

  6. Finish with R2R^2 — and check the denominator is not zero. With yˉ=2.9+4.0+4.93=3.9333\bar y=\frac{2.9+4.0+4.9}{3}=3.9333,

    SStot=(yiyˉ)2=(1.0333)2+(0.0667)2+(0.9667)2=2.00670SS_{\text{tot}}=\sum(y_i-\bar y)^2=(-1.0333)^2+(0.0667)^2+(0.9667)^2=2.0067\neq0

    so R2R^2 is well defined and

    R2=1SSresSStot=102.0067=1R^2=1-\frac{SS_{\text{res}}}{SS_{\text{tot}}}=1-\frac{0}{2.0067}=1

  7. Read the result with the right amount of scepticism. R2=1R^2=1 here is a structural certainty, not evidence that the quadratic model is good. Any three points, however noisy, give R2=1R^2=1 for a quadratic fit, exactly as any two points give R2=1R^2=1 for a straight line. To learn anything about model quality you need more data points than parameters — with n=3n=3 and 33 parameters there are zero residual degrees of freedom, and the adjusted R2R^2 is undefined.

Answer

y=0.001x2+0.14x+1.6,R2=1y=-0.001x^2+0.14x+1.6,\qquad R^2=1

Need to solve a different problem like this? Open the solver →