

For example, in many practical cases, the logarithm of y (or some other function) may be much better at representing the data. Another important case arises if we need to transform the dependent variable, y, in order to get a linear representation.

If there is a drift in the precision of the measurements, for example, some errors may be more or less important than others. It is important to note that this statement assumes that all errors have the same significance, but this is often not true. M represents the number of data points, and N represents the number of linear terms in the regression equation. The standard linear regression problem can be stated mathematically as follows, where y j represents the j th measured or observed dependent variable value, x i,j represents the j th measured independent variable value for the i th variable, and C i is the regression coefficient to be determined.
#Weighted linear regression excel code
The files included with this article contain the source code for the linear regression class, as well as an example program. This article presents a C# implementation of a weighted linear regression, using an efficient symmetric matrix inversion algorithm to overcome the problem of nonlinearity of the dependent variable and to compute the complete variance-covariance matrix to allow estimation of confidence intervals in the estimated regression coefficients. In addition, in many cases, it is not only necessary to compute the best formula to represent the data, but to also estimate the accuracy of the parameters. Unfortunately, there are many times when one knows that the dependent variable is not a linear function, but that a transformed variable might be. The applications of linear least squares and Gaussian elimination are well known techniques. For the case of linear least squares, the resulting analysis requires the solution of a set of simultaneous equations that can be easily solved using Gaussian Elimination. Normally, the regression problem is formulated as a least squares minimization problem. For linear regression, the independent variable (data) is assumed to be a linear function of various independent variables. Linear regression is a useful technique for representing observed data by a mathematical equation.
