Method of least squares

 

Print!

We will start from an example, then to propose a demonstration of the general formulas on a simple case.

This article is addressed to the professors in particular, because it shows how the teaching of this topic can be carried out by the intermediary of the TI-89-92.

Objectives To present the method of least squares
Public
Classes First and Final ES and STT
Sections of High-level techniciens
Prérequis Properties of the trinomial function of the second degree
Idea B.Egger

We will not detail the step, leaving with each one the care to equip it as it is appropriate to him.

 

Presentation on an example

We start from the principle which we do not know the method nor his results.
One considers a statistical series with 2 variables which corresponds to the following table:

X       2.1    1.8    3.4     5.1       6      7.2

y       6.9    4.7   10.8   13.8    16.2   14.1

One enters this table the computer by [ APPS ] Data/Matrix Editor.
MDCAR1.GIF (2003 octets)
One can then envisage the chart which corresponds to him. For that, one makes [ F2 ] then [ F1 ].
One chooses the options opposite in the screen which appears (one can make another choice for the Mark option)

MDCAR2.GIF (1831 octets)

One then will ask the computer to determine the equation of the straight regression line without saying to the pupils that about which it all is.
One presses the key [ F5 ] and one enters the following options:
**time-out** not forget to put y1(x) in the option " Blind Reg To ". That make it possible to preserve the equation of right-hand side in the variable y1 for possibly it trace or it use for some calculation later.

MDCAR3.GIF (1867 octets)

 

The following results then are obtained.

We will not tackle here the question of correlation, but we will propose to find this equation by a calculation assisted by the TI-89-92.

MDCAR4.GIF (1909 octets)

One then represents in the same reference mark the cloud and the curve.

MDCAR5.GIF (1822 octets)

MDCAR6.GIF (1378 octets)

The search of the equation of this curve is preceded by a presentation by the professor by the method of least squares.

Comes then a development step by step from the method.

Useful precision for the continuation : we called ACTIV the statistical table on TI-89-92.

**time-out** one point out the column of table in the screen of calculation (HOME) in make follow the name of table of a number between hook. (Extraction of a line of a matrix)

One calculates then what one names M somme.gif (899 octets)PIItraditionally, that one will seek to undervalue.

MDCAR7.GIF (2148 octets)

 

The polynomial sab in A is degree 2.
The derivative is cancelled for a value of A which corresponds at least.

One replaces in the expression of sab, and one obtains a polynomial of degree 2 out of B.

MDCAR8.GIF (2210 octets)

 

This polynomial reaches its minimum at the point which cancels the derivative.

One then replaces B in the expression of A preceding.

One finds the values of the curve of regression given by the computer.

MDCAR9.GIF (2354 octets)

One can easily make check that this curve passes by the average point of the cloud.
We will find the result starting from 2 statistical series with 4 unspecified elements (we took only 4 elements to facilitate the calculations carried out by the TI-89-92)

 

" general " case

One considers the 2 statistical series data by the following table:

X       a1   a2  a3  a4

y       b1   b2  b3  b4

One takes again the same step as précedemment.

Even step that in the particular case.

MDCAR10.GIF (2093 octets)

 

In the general demonstration, one prefers to start with derivation compared to b: that will in the final analysis make it possible to show that that returns to same, but in more one leads to a formula more usable.

MDCAR11.GIF (2226 octets)

The formula obtained can of multiple handling on the computer lead afterwards to a form " usable ". It is certainly preferable to make a written synthesis of it:

**time-out** B = - A/4 *somme.gif (899 octets)aI - 1/4 *somme.gif (899 octets)bI  (to i=1 to i=4) that one write more frequently under the form y_=a*x_+b, formula which highlight en évidence the membership of point average with straight regression line de régression.

The demonstration of A by the computer mainly poses some problems if one wants to obtain the usual formula, because of the immediate evaluations of partial results which prevent desired working. To block these evaluations, one must replace certain calculations by inert variables.

In the formula called sab, one will carry out following substitutions:

a1+a2+a3+a4 = sx1

a1+a2+a3+a4 = sx2

b1+b2+b3+b4 = sy1

b1+b2+b3+b4 = sy2

a1*b1+a2*b2+a3*b3+a4*b4 = sxy

One can carry out these replacements by successive handling on the computer, but it can be faster of réecrire the formula giving sab with the new variables.

B sécrit then B = - a*sx1/4 + sy1/4

The formula of sab modified is placed in the variable sabb.

One substitutes B by his value according to year sx1 and sy1. One stores the result in sabc.

MDCAR13.GIF (2348 octets)

MDCAR14.GIF (1758 octets)

 

The value of A which cancels the derivative of sabc compared to A is given by the formula in bottom of the screen. In divisnat numerator and denominator by 16, one finds the traditional writing:

has = [ (x*y)_-(x_*y _) ] / (x_-x_)

MDCAR15.GIF (1965 octets)

The two formulas giving has and B being shown in the case of series to 4 elements, one can admit them for unspecified series. The demonstration was voluntarily built a little différement of that given in the particular case.

**time-out** we go return with this one to check that we find well the same result and thus put in obviousness that it be equivalent to begin of a way or of another.

 

Return to the particular case

Initially, it is necessary to supplement the table called ACTIV by a column giving the squares of variable X, and by a column giving the products of variables X and y.

Here, no difficulty to supplement the initial table. One places oneself on c3 and one supplements the line " c3 = " by c3=c1².

In the same way for c4=c1*c2

MDCAR16.GIF (2255 octets)

 

Mdcar17.gif (2003 octets)

MDCAR18.GIF (2074 octets)

The same results are found.

 

We can imagine other activities of the same kind to introduce and present other models of regression.

For our part, we will finish by the exposure of a a little unusual use to the level college (or BTS) of the quadratic or cubic regression.