



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




The figure shows a scatter diagram showing the relationship between two variables X & Y. It is obvious that the two variables have some relationship as the higher values of X are associated with higher values of Y, however it is also visible that the relationship cannot be modeled by a deterministic function of X.
Therefore we assume that the relationship between X and Y is sum of deterministic and stochastic relationship which can be written as follows: ๐ฆ๐ = ๐ผ + ๐ฝ๐ฅ๐ + ๐๐ Where ๐ผ + ๐ฝ๐ฅ๐ is deterministic and๐๐ is stochastic part. The deterministic part we hope to be able to predict, however the stochastic part cannot be predicted.
Obviously, it is desirable to have minimum of the stochastic i.e. unpredictable part. If we ignore the stochastic part we get: ๐ผ + ๐ฝ๐ฅ๐ = ๐ฆ๏ฟฝ This is equation of straight line. This straight lines joins the values on X axis with corresponding predictions on Y axis. We want such a straight line which minimizes the unpredicted part. Instead of focusing on any one ๐๐ we want to minimize the aggregate error. This is a problem which should be solvable by calculus (differentiation]. Let us see how it can be done.
Minimizing aggregate error: We have ๐ฆ๐ โ ๐ผ โ ๐ฝ๐ฅ๐ = ๐๐ There are three options to minimize the aggregate error:
Option I: minimize โ ๐บ (^) ๐ This option is not appropriate because ๐๐ = ๐ฆ๐ โ ๐ฆ๏ฟฝ๐ Here ๐ฆ๏ฟฝ๐ is the prediction of ๐ฆ๐ lying on the straight line. The actual ๐ฆ๐ are on both sides of straight line. If ๐ฆ๐ is above straight line => actual value of ๐ฆ๐ is greater than ๐ฆ๏ฟฝ๐ => ๐๐ is positive. On the other hand, if ๐ฆ๐ is below the straight line => actual value of ๐ฆ๐ is smaller than ๐ฆ๏ฟฝ๐ => ๐๐ is negative. These negative and positive values cancel each other and total result we get is zero.
Option III: minimize โ ๐บ (^) ๐๐ Here the problem posed by the sign of errors is solved by taking squares. The expression is now differentiable and can give us the analytical solution. Let us see how this can be done. Remember the term โ ๐๐^2 is called sum of squared residual (RSS). (Residual is sample counterpart of error, there is difference between residual which will be explained later, so far assume that residual and errors are the same thing). So
๐ ๐๐ = ๏ฟฝ ๐๐^2 = ๏ฟฝ(๐ฆ๐ โ ๐ผ โ ๐ฝ๐ฅ๐)^2
We want to minimize RSS by changing ๐ผ and ๐ฝ, therefore: Differentiating w.r.t. ๐ผ, we get ๐๐ ๐๐ ๐๐ผ =^ โ^2 ๏ฟฝ(๐ฆ๐^ โ ๐ผ โ ๐ฝ๐ฅ๐) = 0 ๏ฐ โ ๐ฆ๐ โ ๐๐ โ โ ๐ฝ๐ฅ๐ = 0 ๏ฐ ๐๐ผ = โ ๐ฆ๐ โ โ ๐ฝ๐ฅ๐ Similarly, differentiating with respect to ๐ฝ we get: ๐๐ ๐๐ ๐๐ฝ =^ โ^2 ๏ฟฝ(๐ฆ๐^ โ ๐ผ โ ๐ฝ๐ฅ๐)๐ฅ๐^ = 0 ๏ฐ โ ๐ฆ๐ ๐ฅ๐ โ ๐ โ ๐ฅ๐ โ ๐ฝ โ ๐ฅ๐^2 = 0 ๏ฐ โ ๐ฆ๐ ๐ฅ๐ โ (^1) ๐ (โ ๐ฆ๐ โ โ ๐ฝ๐ฅ๐) โ ๐ฅ๐ โ ๐ฝ โ ๐ฅ๐^2 = 0 ๏ฐ ๐ โ ๐ฆ๐ ๐ฅ๐ โ โ ๐ฅ๐ โ ๐ฆ๐ + ๐ฝ(โ ๐ฅ๐)^2 โ ๐๐ฝ โ ๐ฅ๐^2 = 0 ๏ฐ ๐ฝฬ = ๐ โ ๐ฆโ(โ ๐ฅ^ ๐^ ๐ฅ (^) ๐^ ๐)^ โโ ๐ฅ (^2) +๐ โ ๐ฅ^ ๐^ โ ๐ฆ (^) ๐ 2 ๐ Here ๐ฝฬ is used to denote estimate from the sample. Using this value, one can find ๐ผ as well.
Example 1: Given the data X Y 10 8 12 7 14 13 16 14 18 15 20 19 Estimate the regression equation ๐ฆ๐ = ๐ผ + ๐ฝ๐ฅ๐ + ๐๐ Solution: X Y XY X^ 10 8 80 100 12 7 84 144 14 13 182 196 16 14 224 256 18 15 270 324 20 19 380 400 โ (^) ๐ฅ๐ = 90 โ (^) ๐ฆ๐ = 76 โ (^) ๐ฅ๐ ๐ฆ๐ = 1220 โ (^) ๐ฅ๐^2 = 1420
Now
where actual value of y should lie, but we will learn this technique later. Exercise Three data sets are given to you. For the first data set:
4 7 6 -3 7 2 1 4 7 -4 3 2 7 9 2 1 5 3 5 9 3 0 2 1 5 6 2 -1 1 4 1 3 7 -3 6 6 3 5 1 1 7 3 7 11 3 1 5 5 4 8 7 -6 6 1 1 2 2 2 2 7 7 8 1 2 4 1 1 3 2 0 2 5 2 6 3 -1 4 7 4 8 1 0 6 5 6 10 1 2 1 3