Which finds the widest application in various fields of science and practical activity. This could be physics, chemistry, biology, economics, sociology, psychology, and so on and so forth. By the will of fate, I often have to deal with the economy, and therefore today I will arrange for you a trip to an amazing country called Econometrics=) ...How can you not want it?! It’s very good there – you just need to make up your mind! ...But what you probably definitely want is to learn how to solve problems least squares method. And especially diligent readers will learn to solve them not only accurately, but also VERY QUICKLY ;-) But first general statement of the problem+ accompanying example:
Let us study indicators in a certain subject area that have a quantitative expression. At the same time, there is every reason to believe that the indicator depends on the indicator. This assumption can be either a scientific hypothesis or based on basic common sense. Let's leave science aside, however, and explore more appetizing areas - namely, grocery stores. Let's denote by:
– retail area of a grocery store, sq.m.,
– annual turnover of a grocery store, million rubles.
It is absolutely clear that the larger the store area, the greater in most cases its turnover will be.
Suppose that after carrying out observations/experiments/calculations/dances with a tambourine we have numerical data at our disposal: 
With grocery stores, I think everything is clear: - this is the area of the 1st store, - its annual turnover, - the area of the 2nd store, - its annual turnover, etc. By the way, it is not at all necessary to have access to classified materials - a fairly accurate assessment of trade turnover can be obtained by means of mathematical statistics. However, let’s not get distracted, the commercial espionage course is already paid =)
Tabular data can also be written in the form of points and depicted in the familiar form Cartesian system .
Let's answer an important question: How many points are needed for a qualitative study?
More the better. The minimum acceptable set consists of 5-6 points. In addition, when the amount of data is small, “anomalous” results cannot be included in the sample. So, for example, a small elite store can earn orders of magnitude more than “its colleagues,” thereby distorting the general pattern that you need to find!
To put it very simply, we need to select a function, schedule which passes as close as possible to the points
. This function is called approximating
(approximation - approximation) or theoretical function
. Generally speaking, an obvious “contender” immediately appears here - a high-degree polynomial, the graph of which passes through ALL points. But this option is complicated and often simply incorrect. (since the graph will “loop” all the time and poorly reflect the main trend).
Thus, the sought function must be quite simple and at the same time adequately reflect the dependence. As you might guess, one of the methods for finding such functions is called least squares method. First, let's look at its essence in general terms. Let some function approximate experimental data: 
How to evaluate the accuracy of this approximation? Let us also calculate the differences (deviations) between the experimental and functional values (we study the drawing). The first thought that comes to mind is to estimate how large the sum is, but the problem is that the differences can be negative (For example,
)
and deviations as a result of such summation will cancel each other out. Therefore, as an estimate of the accuracy of the approximation, it begs to take the sum modules deviations:
or collapsed: (in case anyone doesn’t know: – this is the sum icon, and – an auxiliary “counter” variable, which takes values from 1 to ).
By approximating experimental points with different functions, we will obtain different values, and obviously, where this sum is smaller, that function is more accurate.
Such a method exists and it is called least modulus method. However, in practice it has become much more widespread least squares method, in which possible negative values are eliminated not by the module, but by squaring the deviations:
, after which efforts are aimed at selecting a function such that the sum of squared deviations
was as small as possible. Actually, this is where the name of the method comes from.
And now we return to another important point: as noted above, the selected function should be quite simple - but there are also many such functions: linear , hyperbolic, exponential, logarithmic, quadratic etc. And, of course, here I would immediately like to “reduce the field of activity.” Which class of functions should I choose for research? A primitive but effective technique:
– The easiest way is to depict points
on the drawing and analyze their location. If they tend to run in a straight line, then you should look for equation of a line
with optimal values and . In other words, the task is to find SUCH coefficients so that the sum of squared deviations is the smallest.
If the points are located, for example, along hyperbole, then it is obviously clear that the linear function will give a poor approximation. In this case, we are looking for the most “favorable” coefficients for the hyperbola equation
– those that give the minimum sum of squares
.
Now note that in both cases we are talking about functions of two variables, whose arguments are searched dependency parameters:
And essentially we need to solve a standard problem - find minimum function of two variables.
Let's remember our example: suppose that “store” points tend to be located in a straight line and there is every reason to believe the presence linear dependence turnover from retail space. Let's find SUCH coefficients “a” and “be” such that the sum of squared deviations
was the smallest. Everything is as usual - first 1st order partial derivatives. According to linearity rule You can differentiate right under the sum icon: 
If you want to use this information for an essay or term paper, I will be very grateful for the link in the list of sources; you will find such detailed calculations in few places: 
Let's create a standard system: 
We reduce each equation by “two” and, in addition, “break up” the sums: 
Note
: independently analyze why “a” and “be” can be taken out beyond the sum icon. By the way, formally this can be done with the sum![]()
Let's rewrite the system in “applied” form: 
after which the algorithm for solving our problem begins to emerge:
Do we know the coordinates of the points? We know. Amounts
can we find it? Easily. Let's make the simplest system of two linear equations in two unknowns(“a” and “be”). We solve the system, for example, Cramer's method, as a result of which we obtain a stationary point. Checking sufficient condition for an extremum, we can verify that at this point the function
reaches exactly minimum. The check involves additional calculations and therefore we will leave it behind the scenes (if necessary, the missing frame can be viewed). We draw the final conclusion:
Function
in the best possible way (at least compared to any other linear function) brings experimental points closer
. Roughly speaking, its graph passes as close as possible to these points. In tradition econometrics the resulting approximating function is also called paired linear regression equation
.
The problem under consideration is of great practical importance. In our example situation, Eq.
allows you to predict what trade turnover ("Igrek") the store will have at one or another value of the sales area (one or another meaning of “x”). Yes, the resulting forecast will only be a forecast, but in many cases it will turn out to be quite accurate.
I will analyze just one problem with “real” numbers, since there are no difficulties in it - all calculations are at the level of the 7th-8th grade school curriculum. In 95 percent of cases, you will be asked to find just a linear function, but at the very end of the article I will show that it is no more difficult to find the equations of the optimal hyperbola, exponential and some other functions.
In fact, all that remains is to distribute the promised goodies - so that you can learn to solve such examples not only accurately, but also quickly. We carefully study the standard:
Task
As a result of studying the relationship between two indicators, the following pairs of numbers were obtained: 
Using the least squares method, find the linear function that best approximates the empirical (experienced) data. Make a drawing on which to construct experimental points and a graph of the approximating function in a Cartesian rectangular coordinate system
. Find the sum of squared deviations between the empirical and theoretical values. Find out if the feature would be better (from the point of view of the least squares method) bring experimental points closer.
Please note that the “x” meanings are natural, and this has a characteristic meaningful meaning, which I will talk about a little later; but they, of course, can also be fractional. In addition, depending on the content of a particular task, both “X” and “game” values can be completely or partially negative. Well, we have been given a “faceless” task, and we begin it solution:
We find the coefficients of the optimal function as a solution to the system: 
For the purpose of more compact recording, the “counter” variable can be omitted, since it is already clear that the summation is carried out from 1 to .
It is more convenient to calculate the required amounts in tabular form: 
Calculations can be carried out on a microcalculator, but it is much better to use Excel - both faster and without errors; watch a short video:
Thus, we get the following system:![]()
Here you can multiply the second equation by 3 and subtract the 2nd from the 1st equation term by term. But this is luck - in practice, systems are often not a gift, and in such cases it saves Cramer's method:
, which means the system has a unique solution.

Let's check. I understand that you don’t want to, but why skip mistakes where they can absolutely not be missed? Let us substitute the found solution into the left side of each equation of the system:
The right-hand sides of the corresponding equations are obtained, which means that the system is solved correctly.
Thus, the desired approximating function: – from all linear functions It is she who best approximates the experimental data.
Unlike direct
dependence of the store's turnover on its area, the found dependence is reverse
(principle “the more, the less”), and this fact is immediately revealed by the negative slope. Function
tells us that with an increase in a certain indicator by 1 unit, the value of the dependent indicator decreases on average by 0.65 units. As they say, the higher the price of buckwheat, the less it is sold.
To plot the graph of the approximating function, we find its two values:
and execute the drawing: 
The constructed straight line is called trend line
(namely, a linear trend line, i.e. in the general case, a trend is not necessarily a straight line). Everyone is familiar with the expression “being in trend,” and I think that this term does not need additional comments.
Let's calculate the sum of squared deviations
between empirical and theoretical values. Geometrically, this is the sum of the squares of the lengths of the “raspberry” segments (two of which are so small that they are not even visible).
Let's summarize the calculations in a table: 
Again, they can be done manually; just in case, I’ll give an example for the 1st point: ![]()
but it is much more effective to do it in the already known way:
We repeat once again: What is the meaning of the result obtained? From all linear functions y function
the indicator is the smallest, that is, in its family it is the best approximation. And here, by the way, the final question of the problem is not accidental: what if the proposed exponential function
would it be better to bring the experimental points closer?
Let's find the corresponding sum of squared deviations - to distinguish, I will denote them by the letter “epsilon”. The technique is exactly the same: 
And again, just in case, the calculations for the 1st point: 
In Excel we use the standard function EXP (syntax can be found in Excel Help).
Conclusion: , which means that the exponential function approximates the experimental points worse than a straight line
.
But here it should be noted that “worse” is doesn't mean yet, which is bad. Now I have built a graph of this exponential function - and it also passes close to the points
- so much so that without analytical research it is difficult to say which function is more accurate.
This concludes the solution, and I return to the question of the natural values of the argument. In various studies, usually economic or sociological, natural “X”s are used to number months, years or other equal time intervals. Consider, for example, the following problem.
Example.
Experimental data on the values of variables X And at are given in the table.
As a result of their alignment, the function is obtained
Using least squares method, approximate these data by a linear dependence y=ax+b(find parameters A And b). Find out which of the two lines better (in the sense of the least squares method) aligns the experimental data. Make a drawing.
The essence of the least squares method (LSM).
>The task is to find the linear dependence coefficients at which the function of two variables A And b takes the smallest value. That is, given A And b the sum of squared deviations of the experimental data from the found straight line will be the smallest. This is the whole point of the least squares method.
Thus, solving the example comes down to finding the extremum of a function of two variables.
Deriving formulas for finding coefficients.
>A system of two equations with two unknowns is compiled and solved. Finding partial derivatives of a function with respect to variables A And b, we equate these derivatives to zero.
We solve the resulting system of equations using any method (for example by substitution method or ) and obtain formulas for finding coefficients using the least squares method (LSM).
Given A And b function takes the smallest value. The proof of this fact is given.
That's the whole method of least squares. Formula for finding the parameter a contains the sums , , , and parameter n- amount of experimental data. We recommend calculating the values of these amounts separately. Coefficient b is found after calculation a.
It's time to remember the original example.
Solution.
In our example n=5. We fill out the table for the convenience of calculating the amounts that are included in the formulas of the required coefficients.
The values in the fourth row of the table are obtained by multiplying the values of the 2nd row by the values of the 3rd row for each number i.
The values in the fifth row of the table are obtained by squaring the values in the 2nd row for each number i.
The values in the last column of the table are the sums of the values across the rows.
We use the formulas of the least squares method to find the coefficients A And b. We substitute the corresponding values from the last column of the table into them:
Hence, y = 0.165x+2.184- the desired approximating straight line.
It remains to find out which of the lines y = 0.165x+2.184 or better approximates the original data, that is, estimates using the least squares method.
Error estimation of the least squares method.
>To do this, you need to calculate the sum of squared deviations of the original data from these lines And , a smaller value corresponds to a line that better approximates the original data in the sense of the least squares method.
Since , then straight y = 0.165x+2.184 better approximates the original data.
Graphic illustration of the least squares (LS) method.
>Everything is clearly visible on the graphs. The red line is the found straight line y = 0.165x+2.184, the blue line is , pink dots are the original data.
Why is this needed, why all these approximations?
I personally use it to solve problems of data smoothing, interpolation and extrapolation problems (in the original example they might have been asked to find the value of an observed value y at x=3 or when x=6 using the least squares method). But we’ll talk more about this later in another section of the site.
Proof.
So that when found A And b function takes the smallest value, it is necessary that at this point the matrix of the quadratic form of the second order differential for the function was positive definite. Let's show it.
The second order differential has the form:
That is
Therefore, the matrix of quadratic form has the form
and the values of the elements do not depend on A And b.
Let us show that the matrix is positive definite. To do this, the angular minors must be positive.
First order angular minor . The inequality is strict because the points do not coincide. In what follows we will imply this.
Second order angular minor
Let's prove that by the method of mathematical induction.
Conclusion: found values A And b correspond to the smallest value of the function , therefore, are the required parameters for the least squares method.
Least squares method
In the final lesson of the topic, we will get acquainted with the most famous application FNP, which finds the widest application in various fields of science and practical activity. This could be physics, chemistry, biology, economics, sociology, psychology, and so on and so forth. By the will of fate, I often have to deal with the economy, and therefore today I will arrange for you a trip to an amazing country called Econometrics=) ...How can you not want it?! It’s very good there – you just need to make up your mind! ...But what you probably definitely want is to learn how to solve problems least squares method. And especially diligent readers will learn to solve them not only accurately, but also VERY QUICKLY ;-) But first general statement of the problem+ accompanying example:
Let us study indicators in a certain subject area that have a quantitative expression. At the same time, there is every reason to believe that the indicator depends on the indicator. This assumption can be either a scientific hypothesis or based on basic common sense. Let's leave science aside, however, and explore more appetizing areas - namely, grocery stores. Let's denote by:
– retail area of a grocery store, sq.m.,
– annual turnover of a grocery store, million rubles.
It is absolutely clear that the larger the store area, the greater in most cases its turnover will be.
Suppose that after carrying out observations/experiments/calculations/dances with a tambourine we have numerical data at our disposal: 
With grocery stores, I think everything is clear: - this is the area of the 1st store, - its annual turnover, - the area of the 2nd store, - its annual turnover, etc. By the way, it is not at all necessary to have access to classified materials - a fairly accurate assessment of trade turnover can be obtained by means of mathematical statistics. However, let’s not get distracted, the commercial espionage course is already paid =)
Tabular data can also be written in the form of points and depicted in the familiar form Cartesian system .
Let's answer an important question: How many points are needed for a qualitative study?
More the better. The minimum acceptable set consists of 5-6 points. In addition, when the amount of data is small, “anomalous” results cannot be included in the sample. So, for example, a small elite store can earn orders of magnitude more than “its colleagues,” thereby distorting the general pattern that you need to find!
To put it very simply, we need to select a function, schedule which passes as close as possible to the points
. This function is called approximating
(approximation - approximation) or theoretical function
. Generally speaking, an obvious “contender” immediately appears here - a high-degree polynomial, the graph of which passes through ALL points. But this option is complicated and often simply incorrect. (since the graph will “loop” all the time and poorly reflect the main trend).
Thus, the sought function must be quite simple and at the same time adequately reflect the dependence. As you might guess, one of the methods for finding such functions is called least squares method. First, let's look at its essence in general terms. Let some function approximate experimental data: 
How to evaluate the accuracy of this approximation? Let us also calculate the differences (deviations) between the experimental and functional values (we study the drawing). The first thought that comes to mind is to estimate how large the sum is, but the problem is that the differences can be negative (For example,
)
and deviations as a result of such summation will cancel each other out. Therefore, as an estimate of the accuracy of the approximation, it begs to take the sum modules deviations:
or collapsed: (in case anyone doesn't know:
is the sum icon, and
– an auxiliary “counter” variable, which takes values from 1 to
)
.
By approximating experimental points with different functions, we will obtain different values, and obviously, where this sum is smaller, that function is more accurate.
Such a method exists and it is called least modulus method. However, in practice it has become much more widespread least squares method, in which possible negative values are eliminated not by the module, but by squaring the deviations:
, after which efforts are aimed at selecting a function such that the sum of squared deviations
was as small as possible. Actually, this is where the name of the method comes from.
And now we return to another important point: as noted above, the selected function should be quite simple - but there are also many such functions: linear , hyperbolic , exponential , logarithmic , quadratic etc. And, of course, here I would immediately like to “reduce the field of activity.” Which class of functions should I choose for research? A primitive but effective technique:
– The easiest way is to depict points
on the drawing and analyze their location. If they tend to run in a straight line, then you should look for equation of a line
with optimal values and . In other words, the task is to find SUCH coefficients so that the sum of squared deviations is the smallest.
If the points are located, for example, along hyperbole, then it is obviously clear that the linear function will give a poor approximation. In this case, we are looking for the most “favorable” coefficients for the hyperbola equation
– those that give the minimum sum of squares
.
Now note that in both cases we are talking about functions of two variables, whose arguments are searched dependency parameters:
And essentially we need to solve a standard problem - find minimum function of two variables.
Let's remember our example: suppose that “store” points tend to be located in a straight line and there is every reason to believe the presence linear dependence turnover from retail space. Let's find SUCH coefficients “a” and “be” such that the sum of squared deviations
was the smallest. Everything is as usual - first 1st order partial derivatives. According to linearity rule You can differentiate right under the sum icon: 
If you want to use this information for an essay or term paper, I will be very grateful for the link in the list of sources; you will find such detailed calculations in few places: 
Let's create a standard system: 
We reduce each equation by “two” and, in addition, “break up” the sums: 
Note
: independently analyze why “a” and “be” can be taken out beyond the sum icon. By the way, formally this can be done with the sum ![]()
Let's rewrite the system in “applied” form: 
after which the algorithm for solving our problem begins to emerge:
Do we know the coordinates of the points? We know. Amounts
can we find it? Easily. Let's make the simplest system of two linear equations in two unknowns(“a” and “be”). We solve the system, for example, Cramer's method, as a result of which we obtain a stationary point. Checking sufficient condition for an extremum, we can verify that at this point the function
reaches exactly minimum. The check involves additional calculations and therefore we will leave it behind the scenes (if necessary, the missing frame can be viewedHere
)
. We draw the final conclusion:
Function
in the best possible way (at least compared to any other linear function) brings experimental points closer
. Roughly speaking, its graph passes as close as possible to these points. In tradition econometrics the resulting approximating function is also called paired linear regression equation
.
The problem under consideration is of great practical importance. In our example situation, Eq.
allows you to predict what trade turnover ("Igrek") the store will have at one or another value of the sales area (one or another meaning of “x”). Yes, the resulting forecast will only be a forecast, but in many cases it will turn out to be quite accurate.
I will analyze just one problem with “real” numbers, since there are no difficulties in it - all calculations are at the level of the 7th-8th grade school curriculum. In 95 percent of cases, you will be asked to find just a linear function, but at the very end of the article I will show that it is no more difficult to find the equations of the optimal hyperbola, exponential and some other functions.
In fact, all that remains is to distribute the promised goodies - so that you can learn to solve such examples not only accurately, but also quickly. We carefully study the standard:
Task
As a result of studying the relationship between two indicators, the following pairs of numbers were obtained: 
Using the least squares method, find the linear function that best approximates the empirical (experienced) data. Make a drawing on which to construct experimental points and a graph of the approximating function in a Cartesian rectangular coordinate system
. Find the sum of squared deviations between the empirical and theoretical values. Find out if the feature would be better (from the point of view of the least squares method) bring experimental points closer.
Please note that the “x” meanings are natural, and this has a characteristic meaningful meaning, which I will talk about a little later; but they, of course, can also be fractional. In addition, depending on the content of a particular task, both “X” and “game” values can be completely or partially negative. Well, we have been given a “faceless” task, and we begin it solution:
We find the coefficients of the optimal function as a solution to the system: 
For the purpose of more compact recording, the “counter” variable can be omitted, since it is already clear that the summation is carried out from 1 to .
It is more convenient to calculate the required amounts in tabular form: 
Calculations can be carried out on a microcalculator, but it is much better to use Excel - both faster and without errors; watch a short video:
Thus, we get the following system:![]()
Here you can multiply the second equation by 3 and subtract the 2nd from the 1st equation term by term. But this is luck - in practice, systems are often not a gift, and in such cases it saves Cramer's method:
, which means the system has a unique solution.

Let's check. I understand that you don’t want to, but why skip mistakes where they can absolutely not be missed? Let us substitute the found solution into the left side of each equation of the system:
The right-hand sides of the corresponding equations are obtained, which means that the system is solved correctly.
Thus, the desired approximating function: – from all linear functions It is she who best approximates the experimental data.
Unlike direct
dependence of the store's turnover on its area, the found dependence is reverse
(principle “the more, the less”), and this fact is immediately revealed by the negative slope. Function
tells us that with an increase in a certain indicator by 1 unit, the value of the dependent indicator decreases on average by 0.65 units. As they say, the higher the price of buckwheat, the less it is sold.
To plot the graph of the approximating function, we find its two values:
and execute the drawing: 
The constructed straight line is called trend line
(namely, a linear trend line, i.e. in the general case, a trend is not necessarily a straight line). Everyone is familiar with the expression “being in trend,” and I think that this term does not need additional comments.
Let's calculate the sum of squared deviations
between empirical and theoretical values. Geometrically, this is the sum of the squares of the lengths of the “raspberry” segments (two of which are so small that they are not even visible).
Let's summarize the calculations in a table: 
Again, they can be done manually; just in case, I’ll give an example for the 1st point: ![]()
but it is much more effective to do it in the already known way:
We repeat once again: What is the meaning of the result obtained? From all linear functions y function
the indicator is the smallest, that is, in its family it is the best approximation. And here, by the way, the final question of the problem is not accidental: what if the proposed exponential function
would it be better to bring the experimental points closer?
Let's find the corresponding sum of squared deviations - to distinguish, I will denote them by the letter “epsilon”. The technique is exactly the same: 
And again, just in case, the calculations for the 1st point: 
In Excel we use the standard function EXP (syntax can be found in Excel Help).
Conclusion: , which means that the exponential function approximates the experimental points worse than a straight line
.
But here it should be noted that “worse” is doesn't mean yet, which is bad. Now I have built a graph of this exponential function - and it also passes close to the points
- so much so that without analytical research it is difficult to say which function is more accurate.
This concludes the solution, and I return to the question of the natural values of the argument. In various studies, usually economic or sociological, natural “X”s are used to number months, years or other equal time intervals. Consider, for example, the following problem:
The following data is available on the store’s retail turnover for the first half of the year:
Using analytical straight line alignment, determine the volume of turnover for July.
Yes, no problem: we number the months 1, 2, 3, 4, 5, 6 and use the usual algorithm, as a result of which we get an equation - the only thing is that when it comes to time, they usually use the letter “te” (although this is not critical). The resulting equation shows that in the first half of the year trade turnover increased by an average of 27.74 units. per month. Let's get the forecast for July (month no. 7): d.e.
And there are countless tasks like this. Those who wish can use an additional service, namely my Excel calculator (demo version), which solves the analyzed problem almost instantly! Working version of the program is available on exchange or for symbolic fee.
At the end of the lesson, brief information about finding dependencies of some other types. Actually, there’s not much to tell, since the fundamental approach and solution algorithm remain the same.
Let us assume that the arrangement of the experimental points resembles a hyperbola. Then, to find the coefficients of the best hyperbola, you need to find the minimum of the function - anyone can carry out detailed calculations and arrive at a similar system: 
From a formal technical point of view, it is obtained from a “linear” system
(let's denote it with an asterisk) replacing "x" with . Well, what about the amounts?
calculate, after which to the optimal coefficients “a” and “be” close at hand.
If there is every reason to believe that the points
are located along a logarithmic curve, then to find the optimal values we find the minimum of the function
. Formally, in the system (*) needs to be replaced with: 
When performing calculations in Excel, use the function LN. I confess that it would not be particularly difficult for me to create calculators for each of the cases under consideration, but it would still be better if you “programmed” the calculations yourself. Lesson videos to help.
With exponential dependence the situation is a little more complicated. To reduce the matter to the linear case, we take the function logarithm and use properties of the logarithm:
Now, comparing the resulting function with the linear function, we come to the conclusion that in the system (*) must be replaced by , and – by . For convenience, let's denote: 
Please note that the system is resolved with respect to and, and therefore, after finding the roots, you must not forget to find the coefficient itself.
To bring experimental points closer
optimal parabola
, should be found minimum function of three variables
. After performing standard actions, we get the following “working” system:
Yes, of course, there are more amounts here, but there are no difficulties at all when using your favorite application. And finally, I’ll tell you how to quickly perform a check using Excel and build the desired trend line: create a scatter plot, select any of the points with the mouse
and right click select the option "Add trend line". Next, select the chart type and on the tab "Options" activate the option "Show equation on diagram". OK
As always, I want to end the article with some beautiful phrase, and I almost typed “Be in trend!” But he changed his mind in time. And not because it is stereotyped. I don’t know how it is for anyone, but I don’t really want to follow the promoted American and especially European trend =) Therefore, I wish each of you to stick to your own line!
http://www.grandars.ru/student/vysshaya-matematika/metod-naimenshih-kvadratov.html
The least squares method is one of the most common and most developed due to its simplicity and efficiency of methods for estimating parameters of linear econometric models. At the same time, when using it, some caution should be observed, since models constructed using it may not satisfy a number of requirements for the quality of their parameters and, as a result, do not “well” reflect the patterns of process development.
Let us consider the procedure for estimating the parameters of a linear econometric model using the least squares method in more detail. Such a model in general can be represented by equation (1.2):
y t = a 0 + a 1 x 1t +...+ a n x nt + ε t.
The initial data when estimating the parameters a 0 , a 1 ,..., a n is a vector of values of the dependent variable y= (y 1 , y 2 , ... , y T)" and the matrix of values of independent variables

in which the first column, consisting of ones, corresponds to the model coefficient.
The least squares method received its name based on the basic principle that the parameter estimates obtained on its basis must satisfy: the sum of squares of the model error should be minimal.
Examples of solving problems using the least squares method
Example 2.1. The trading enterprise has a network of 12 stores, information on the activities of which is presented in table. 2.1.
The management of the enterprise would like to know how the size of the annual turnover depends on the retail space of the store.
Table 2.1
| Store number | Annual turnover, million rubles. | Retail area, thousand m2 |
| 19,76 | 0,24 | |
| 38,09 | 0,31 | |
| 40,95 | 0,55 | |
| 41,08 | 0,48 | |
| 56,29 | 0,78 | |
| 68,51 | 0,98 | |
| 75,01 | 0,94 | |
| 89,05 | 1,21 | |
| 91,13 | 1,29 | |
| 91,26 | 1,12 | |
| 99,84 | 1,29 | |
| 108,55 | 1,49 |
Least squares solution. Let us denote the annual turnover of the th store, million rubles; - retail area of the th store, thousand m2.

Fig.2.1. Scatterplot for Example 2.1
To determine the form of the functional relationship between the variables and we will construct a scatter diagram (Fig. 2.1).
Based on the scatter diagram, we can conclude that annual turnover is positively dependent on retail space (i.e., y will increase with increasing ). The most suitable form of functional connection is linear.
Information for further calculations is presented in table. 2.2. Using the least squares method, we estimate the parameters of a linear one-factor econometric model

Table 2.2
| t | y t | x 1t | y t 2 | x 1t 2 | x 1t y t |
| 19,76 | 0,24 | 390,4576 | 0,0576 | 4,7424 | |
| 38,09 | 0,31 | 1450,8481 | 0,0961 | 11,8079 | |
| 40,95 | 0,55 | 1676,9025 | 0,3025 | 22,5225 | |
| 41,08 | 0,48 | 1687,5664 | 0,2304 | 19,7184 | |
| 56,29 | 0,78 | 3168,5641 | 0,6084 | 43,9062 | |
| 68,51 | 0,98 | 4693,6201 | 0,9604 | 67,1398 | |
| 75,01 | 0,94 | 5626,5001 | 0,8836 | 70,5094 | |
| 89,05 | 1,21 | 7929,9025 | 1,4641 | 107,7505 | |
| 91,13 | 1,29 | 8304,6769 | 1,6641 | 117,5577 | |
| 91,26 | 1,12 | 8328,3876 | 1,2544 | 102,2112 | |
| 99,84 | 1,29 | 9968,0256 | 1,6641 | 128,7936 | |
| 108,55 | 1,49 | 11783,1025 | 2,2201 | 161,7395 | |
| S | 819,52 | 10,68 | 65008,554 | 11,4058 | 858,3991 |
| Average | 68,29 | 0,89 |
Thus,
Therefore, with an increase in retail space by 1 thousand m2, other things being equal, the average annual turnover increases by 67.8871 million rubles.
Example 2.2. The company's management noticed that the annual turnover depends not only on the store's sales area (see example 2.1), but also on the average number of visitors. The relevant information is presented in table. 2.3.
Table 2.3
Solution. Let us denote - the average number of visitors to the th store per day, thousand people.
To determine the form of the functional relationship between the variables and we will construct a scatter diagram (Fig. 2.2).
Based on the scatterplot, we can conclude that annual turnover is positively dependent on the average number of visitors per day (i.e., y will increase with increasing ). The form of functional dependence is linear.

Rice. 2.2. Scatterplot for Example 2.2
Table 2.4
| t | x 2t | x 2t 2 | y t x 2t | x 1t x 2t |
| 8,25 | 68,0625 | 163,02 | 1,98 | |
| 10,24 | 104,8575 | 390,0416 | 3,1744 | |
| 9,31 | 86,6761 | 381,2445 | 5,1205 | |
| 11,01 | 121,2201 | 452,2908 | 5,2848 | |
| 8,54 | 72,9316 | 480,7166 | 6,6612 | |
| 7,51 | 56,4001 | 514,5101 | 7,3598 | |
| 12,36 | 152,7696 | 927,1236 | 11,6184 | |
| 10,81 | 116,8561 | 962,6305 | 13,0801 | |
| 9,89 | 97,8121 | 901,2757 | 12,7581 | |
| 13,72 | 188,2384 | 1252,0872 | 15,3664 | |
| 12,27 | 150,5529 | 1225,0368 | 15,8283 | |
| 13,92 | 193,7664 | 1511,016 | 20,7408 | |
| S | 127,83 | 1410,44 | 9160,9934 | 118,9728 |
| Average | 10,65 |
In general, it is necessary to determine the parameters of a two-factor econometric model
y t = a 0 + a 1 x 1t + a 2 x 2t + ε t
The information required for further calculations is presented in table. 2.4.
Let us estimate the parameters of a linear two-factor econometric model using the least squares method.

Thus,
Estimation of the coefficient =61.6583 shows that, other things being equal, with an increase in retail space by 1 thousand m 2, the annual turnover will increase by an average of 61.6583 million rubles.
The coefficient estimate = 2.2748 shows that, other things being equal, with an increase in the average number of visitors per 1 thousand people. per day, annual turnover will increase by an average of 2.2748 million rubles.
Example 2.3. Using the information presented in table. 2.2 and 2.4, estimate the parameter of the one-factor econometric model
![]()
where is the centered value of the annual turnover of the th store, million rubles; - centered value of the average daily number of visitors to the t-th store, thousand people. (see examples 2.1-2.2).
Solution. Additional information required for calculations is presented in table. 2.5.
Table 2.5
| -48,53 | -2,40 | 5,7720 | 116,6013 | |
| -30,20 | -0,41 | 0,1702 | 12,4589 | |
| -27,34 | -1,34 | 1,8023 | 36,7084 | |
| -27,21 | 0,36 | 0,1278 | -9,7288 | |
| -12,00 | -2,11 | 4,4627 | 25,3570 | |
| 0,22 | -3,14 | 9,8753 | -0,6809 | |
| 6,72 | 1,71 | 2,9156 | 11,4687 | |
| 20,76 | 0,16 | 0,0348 | 3,2992 | |
| 22,84 | -0,76 | 0,5814 | -17,413 | |
| 22,97 | 3,07 | 9,4096 | 70,4503 | |
| 31,55 | 1,62 | 2,6163 | 51,0267 | |
| 40,26 | 3,27 | 10,6766 | 131,5387 | |
| Amount | 48,4344 | 431,0566 |
Using formula (2.35), we obtain

Thus,
![]()
http://www.cleverstudents.ru/articles/mnk.html
Example.
Experimental data on the values of variables X And at are given in the table. 
As a result of their alignment, the function is obtained ![]()
Using least squares method, approximate these data by a linear dependence y=ax+b(find parameters A And b). Find out which of the two lines better (in the sense of the least squares method) aligns the experimental data. Make a drawing.
Solution.
In our example n=5. We fill out the table for the convenience of calculating the amounts that are included in the formulas of the required coefficients. 
The values in the fourth row of the table are obtained by multiplying the values of the 2nd row by the values of the 3rd row for each number i.
The values in the fifth row of the table are obtained by squaring the values in the 2nd row for each number i.
The values in the last column of the table are the sums of the values across the rows.
We use the formulas of the least squares method to find the coefficients A And b. We substitute the corresponding values from the last column of the table into them: 
Hence, y = 0.165x+2.184- the desired approximating straight line.
It remains to find out which of the lines y = 0.165x+2.184 or
better approximates the original data, that is, estimates using the least squares method.
Proof.
So that when found A And b function takes the smallest value, it is necessary that at this point the matrix of the quadratic form of the second order differential for the function
was positive definite. Let's show it.
The second order differential has the form: 
That is
Therefore, the matrix of quadratic form has the form 
and the values of the elements do not depend on A And b.
Let us show that the matrix is positive definite. To do this, the angular minors must be positive.
First order angular minor
. The inequality is strict, since the points
- Introductory lesson for free;
- A large number of experienced teachers (native and Russian-speaking);
- Courses are NOT for a specific period (month, six months, year), but for a specific number of lessons (5, 10, 20, 50);
- More than 10,000 satisfied customers.
- The cost of one lesson with a Russian-speaking teacher is from 600 rubles, with a native speaker - from 1500 rubles
The essence of the least squares method is in finding the parameters of a trend model that best describes the tendency of development of any random phenomenon in time or space (a trend is a line that characterizes the tendency of this development). The task of the least squares method (LSM) comes down to finding not just some trend model, but to finding the best or optimal model. This model will be optimal if the sum of square deviations between the observed actual values and the corresponding calculated trend values is minimal (smallest):
where is the square deviation between the observed actual value
and the corresponding calculated trend value,
The actual (observed) value of the phenomenon being studied,
The calculated value of the trend model,
Number of observations of the phenomenon being studied.
MNC is used quite rarely on its own. As a rule, most often it is used only as a necessary technical technique in correlation studies. It should be remembered that the information basis of OLS can only be a reliable statistical series, and the number of observations should not be less than 4, otherwise the smoothing procedures of OLS may lose common sense.
The MNC toolkit boils down to the following procedures:
First procedure. It turns out whether there is any tendency at all to change the resultant attribute when the selected factor-argument changes, or in other words, is there a connection between “ at " And " X ».
Second procedure. It is determined which line (trajectory) can best describe or characterize this trend.
Third procedure.
Example. Let's say we have information about the average sunflower yield for the farm under study (Table 9.1).
Table 9.1
|
Observation number |
||||||||||
|
Productivity, c/ha |
Since the level of technology in sunflower production in our country has remained virtually unchanged over the past 10 years, it means that, apparently, fluctuations in yield during the analyzed period were very much dependent on fluctuations in weather and climatic conditions. Is this really true?
First OLS procedure. The hypothesis about the existence of a trend in sunflower yield changes depending on changes in weather and climatic conditions over the analyzed 10 years is tested.
In this example, for " y " it is advisable to take the sunflower yield, and for " x » – number of the observed year in the analyzed period. Testing the hypothesis about the existence of any relationship between " x " And " y "can be done in two ways: manually and using computer programs. Of course, if you have computer technology, this problem can be solved by itself. But in order to better understand the MNC tools, it is advisable to test the hypothesis about the existence of a relationship between “ x " And " y » manually, when only a pen and an ordinary calculator are at hand. In such cases, the hypothesis about the existence of a trend is best checked visually by the location of the graphical image of the analyzed series of dynamics - the correlation field:
The correlation field in our example is located around a slowly increasing line. This in itself indicates the existence of a certain trend in changes in sunflower yields. It is impossible to talk about the presence of any tendency only when the correlation field looks like a circle, a circle, a strictly vertical or strictly horizontal cloud, or consists of chaotically scattered points. In all other cases, the hypothesis about the existence of a relationship between “ x " And " y ", and continue research.
Second OLS procedure. It is determined which line (trajectory) can best describe or characterize the trend of changes in sunflower yield over the analyzed period.
If you have computer technology, the selection of the optimal trend occurs automatically. In “manual” processing, the selection of the optimal function is carried out, as a rule, visually - by the location of the correlation field. That is, based on the type of graph, the equation of the line that best fits the empirical trend (the actual trajectory) is selected.
As is known, in nature there is a huge variety of functional dependencies, so it is extremely difficult to visually analyze even a small part of them. Fortunately, in real economic practice, most relationships can be described quite accurately either by a parabola, or a hyperbola, or a straight line. In this regard, with the “manual” option of selecting the best function, you can limit yourself to only these three models.
|
Hyperbola: |
||
Second order parabola: :
It is easy to see that in our example, the trend in sunflower yield changes over the analyzed 10 years is best characterized by a straight line, so the regression equation will be the equation of a straight line.
Third procedure. The parameters of the regression equation characterizing this line are calculated, or in other words, an analytical formula is determined that describes the best trend model.
Finding the values of the parameters of the regression equation, in our case the parameters and , is the core of the OLS. This process comes down to solving a system of normal equations.
(9.2)
This system of equations can be solved quite easily by the Gauss method. Let us recall that as a result of the solution, in our example, the values of the parameters and are found. Thus, the found regression equation will have the following form:
It is widely used in econometrics in the form of a clear economic interpretation of its parameters.
Linear regression comes down to finding an equation of the form
or
Equation of the form allows based on specified parameter values X have theoretical values of the resultant characteristic, substituting the actual values of the factor into it X.
The construction of linear regression comes down to estimating its parameters - A And V. Linear regression parameter estimates can be found using different methods.
The classical approach to estimating linear regression parameters is based on least squares method(MNC).
The least squares method allows us to obtain such parameter estimates A And V, at which the sum of squared deviations of the actual values of the resultant characteristic (y) from calculated (theoretical) minimum:
To find the minimum of a function, you need to calculate the partial derivatives for each of the parameters A And b and set them equal to zero.
Let us denote by S, then:
Transforming the formula, we obtain the following system of normal equations for estimating parameters A And V:
Solving the system of normal equations (3.5) either by the method of sequential elimination of variables or by the method of determinants, we find the required estimates of the parameters A And V.
Parameter V called the regression coefficient. Its value shows the average change in the result with a change in the factor by one unit.
The regression equation is always supplemented with an indicator of the closeness of the connection. When using linear regression, such an indicator is the linear correlation coefficient. There are different modifications of the linear correlation coefficient formula. Some of them are given below:
As is known, the linear correlation coefficient is within the limits: -1 ≤ ≤ 1.
To assess the quality of selection of a linear function, the square is calculated
Linear correlation coefficient called coefficient of determination. The coefficient of determination characterizes the proportion of variance of the resulting characteristic y, explained by regression in the total variance of the resulting trait:
Accordingly, the value 1 characterizes the share of variance y, caused by the influence of other factors not taken into account in the model.
Questions for self-control
1. The essence of the least squares method?
2. How many variables does pairwise regression provide?
3. What coefficient determines the closeness of the connection between changes?
4. Within what limits is the coefficient of determination determined?
5. Estimation of parameter b in correlation-regression analysis?
1. Christopher Dougherty. Introduction to econometrics. - M.: INFRA - M, 2001 - 402 p.
2. S.A. Borodich. Econometrics. Minsk LLC “New Knowledge” 2001.
3. R.U. Rakhmetova Short course in econometrics. Study guide. Almaty. 2004. -78p.
4. I.I. Eliseeva. Econometrics. - M.: “Finance and Statistics”, 2002
5. Monthly information and analytical magazine.
Nonlinear economic models. Nonlinear regression models. Transformation of variables.
>Nonlinear economic models..
Transformation of variables.
Elasticity coefficient.
If there are nonlinear relationships between economic phenomena, then they are expressed using the corresponding nonlinear functions: for example, an equilateral hyperbola , parabolas of the second degree, etc.
There are two classes of nonlinear regressions
>1. Regressions that are nonlinear with respect to the explanatory variables included in the analysis, but linear with respect to the estimated parameters, for example:
Polynomials of various degrees - , ;
Equilateral hyperbola - ;
Semilogarithmic function - .
2. Regressions that are nonlinear in the parameters being estimated, for example:
Power - ;
Demonstrative - ;
Exponential - .
The total sum of squared deviations of individual values of the resulting characteristic at from the average value is caused by the influence of many reasons. Let us conditionally divide the entire set of reasons into two groups: factor being studied x And other factors.
If the factor does not influence the result, then the regression line on the graph is parallel to the axis Oh And
Then the entire variance of the resulting characteristic is due to the influence of other factors and the total sum of squared deviations will coincide with the residual. If other factors do not influence the result, then y tied With X functionally and the residual sum of squares is zero. In this case, the sum of squared deviations explained by the regression is the same as the total sum of squares.
Since not all points of the correlation field lie on the regression line, their scatter always occurs as a result of the influence of the factor X, i.e. regression at By X, and caused by other causes (unexplained variation). The suitability of a regression line for forecasting depends on what part of the total variation of the trait at accounts for the explained variation
Obviously, if the sum of squared deviations due to regression is greater than the residual sum of squares, then the regression equation is statistically significant and the factor X has a significant impact on the result u.
, i.e., with the number of freedom of independent variation of a characteristic. The number of degrees of freedom is related to the number of units of the population n and the number of constants determined from it. In relation to the problem under study, the number of degrees of freedom should show how many independent deviations from n
The assessment of the significance of the regression equation as a whole is given using F-Fisher criterion. In this case, a null hypothesis is put forward that the regression coefficient is equal to zero, i.e. b = 0, and therefore the factor X does not affect the result u.
The immediate calculation of the F-test is preceded by analysis of variance. The central place in it is occupied by the decomposition of the total sum of squared deviations of a variable at from the average value at into two parts - “explained” and “unexplained”:
Total sum of squared deviations;
Sum of squared deviation explained by regression;
Residual sum of squared deviations.
Any sum of squared deviations is related to the number of degrees of freedom , i.e., with the number of freedom of independent variation of a characteristic. The number of degrees of freedom is related to the number of population units n and with the number of constants determined from it. In relation to the problem under study, the number of degrees of freedom should show how many independent deviations from n possible required to form a given sum of squares.
Dispersion per degree of freedomD.
F-ratios (F-test):
If the null hypothesis is true, then the factor and residual variances do not differ from each other. For H 0, a refutation is necessary so that the factor dispersion exceeds the residual dispersion several times. The English statistician Snedekor developed tables of critical values F-relations at different levels of significance of the null hypothesis and different numbers of degrees of freedom. Table value F-criterion is the maximum value of the ratio of variances that can occur in case of random divergence for a given level of probability of the presence of the null hypothesis. Calculated value F-relationships are considered reliable if o is greater than the table.
In this case, the null hypothesis about the absence of a relationship between signs is rejected and a conclusion is drawn about the significance of this relationship: F fact > F table H 0 is rejected.
If the value is less than the tabulated F fact ‹, F table, then the probability of the null hypothesis is higher than a specified level and cannot be rejected without serious risk of drawing the wrong conclusion about the presence of a relationship. In this case, the regression equation is considered statistically insignificant. But he doesn’t deviate.
Standard error of regression coefficient
To assess the significance of the regression coefficient, its value is compared with its standard error, i.e. the actual value is determined t-Student's t-test: which is then compared with the table value at a certain level of significance and number of degrees of freedom ( n- 2).
Standard parameter error A:
The significance of the linear correlation coefficient is checked based on the magnitude of the error correlation coefficient t r:
Total trait variance X:
Multiple Linear Regression
Model building
Multiple regression represents a regression of an effective characteristic with two or more factors, i.e. a model of the form
Regression can give good results in modeling if the influence of other factors affecting the object of study can be neglected. The behavior of individual economic variables cannot be controlled, i.e. it is not possible to ensure the equality of all other conditions for assessing the influence of one factor under study. In this case, you should try to identify the influence of other factors by introducing them into the model, i.e., construct a multiple regression equation: y = a+b 1 x 1 +b 2 +…+b p x p + .
The main goal of multiple regression is to build a model with a large number of factors, while determining the influence of each of them separately, as well as their combined impact on the modeled indicator. The specification of the model includes two ranges of issues: selection of factors and choice of the type of regression equation

