Books and articles about SQL   Сменить язык на: Русский 07 August 2020 11:49:11   Print version

Main page

## Least-square method

Let us have the set of values yi, every one of which corresponds to any moment of time ti (i = 1,2,…,N). We need to find dependency y = f(t) if the sum of squared divergences of points of curve from the appropriate point yi is the minimal in the class of approximating functions. That is

(1) Σ (f(ti) – yi)2 min

We will find the solution in the class of the linear functions (straight lines): y = at + b. Then the term (1) we can write as the following

Σ (a*ti +b – yi)2 min

The necessary condition of the existence of minimum is the equality to zero of two partial derivatives on a and b  accordingly:

Σ ((a*ti +b – yi)*ti) =0

Σ (a*ti +b – yi) = 0

In designations

Σ (ti*ti) = stt

Σ (yi*ti) = syt

Σ (ti) = st

Σ (yi) = sy

the system can be rewritten as the following

a*stt + b*st – syt = 0

a*st +b*N – sy = 0

Solving this system of two linear equations for a and b we will get

a = (syt*N – sy*st)/(N*stt – st*st)

b = (stt*sy – syt*st)/(N*stt – st*st)

Main page Print version


 Usage of any materials of this site is possibleonly under condition of mandatory allocation of the direct link to a sitehttp://www.sqlbooks.ruon each page where used materials are placed. Main Articles Books     Copyright c 2002-2006. All rights reserved. contact