Home > Articles > Home & Office Computing > Microsoft Applications

How Excel's LINEST() Handles Collinearity

As of Excel 2003, Microsoft has shifted in its manner of calculating the statistics returned by LINEST() from the traditional normal equations to QR decomposition. The shift is meant to improve the accuracy of LINEST()'s reported results, an improvement that does not show up until somewhere around the 15th or 16th decimal place. An additional rationale for the shift is that QR decomposition assists in identifying multicollinearity in the predictor variables: an identification that can be tedious and time-consuming if done using matrix determinants. Excel expert Conrad Carlberg, author of Predictive Analytics: Microsoft Excel, discusses the implications of the manner in which LINEST() implements QR decomposition for its results—implications which are largely undocumented and which involve the unannounced removal of a variable from the regression equation.
Like this article? We recommend

Like this article? We recommend

It's not unusual—in fact, it's the normal state of affairs—for the predictor variables in a multiple regression equation to be correlated with one another. Suppose that you were investigating the relationship between income as an outcome variable, and age and years of education as predictor variables.

You expect age to be positively correlated with years of education. You don't expect a perfect correlation of 1.0 between the two variables, but you're not at all surprised to find a moderately strong correlation, something along the lines of 0.7.

Multiple regression analysis in general (and Excel's LINEST() function in particular) is perfectly capable of dealing with correlated predictor variables (what Excel terms the x-values, as distinct from the outcome variable's y-values).

In fact, that’s one of the purposes of multiple regression analysis: to determine the amount of variability in the outcome variable that's uniquely attributable to each predictor variable. And to determine that unique portion of the variance, you have to be able to untangle the relationships between the predictor variables. Among the methods of doing so is the models comparison approach, as well as a technique which works beautifully with Excel's relative and absolute addressing, detailed in Chapter 12 of Statistical Analysis: Microsoft Excel 2010, Que, 2011.

Troublesome Collinearity

But there's a problem when one of the predictor variables is completely dependent on one or more of the other predictors. In that case, traditional approaches to generating the multiple regression equation (and the goodness-of-fit statistics such as R2) are uninterpretable or simply wrong. See Figure 1 for an example.

Figure 1 In Excel 2002, LINEST() returns a zero for each of the regression coefficient standard errors.

The particular result shown in Figure 1 is due to Excel 2002 (and earlier versions), and to the particular set of inputs. The input values result in a sum of squares and cross products (SSCP) matrix, denoted as X. The matrix product X'X can be inverted, but the inverse has negative values on the main diagonal and therefore returns negative standard errors. Excel 2002 evidently converts negative standard errors to zeros.

Figure 2 depicts another, related problem with the Excel 2002 version of LINEST().

Figure 2 In Excel 2002, LINEST() returns nothing but #NUM! error values for this set of inputs.

In Figure 2, the problem is that the collinearity causes the X'X product matrix to have no inverse (it has a determinant of zero), and therefore none of the regression statistics can be calculated using traditional approaches.

QR Decomposition

The "traditional approaches" I mention in the prior paragraph have to do with fairly straightforward techniques of matrix algebra: matrix transposition, multiplication, and inversion (although no matrix inversion process should be termed "straightforward" if more than three variables are involved).

In Excel 2003 through 2010, Microsoft employs a different approach to solving the multiple regression problem: QR decomposition. This process has two advantages:

  • QR decomposition is not stumped by serious collinearity, as is the process of matrix inversion. The multiple regression calculations can be completed and an alternative result provided, one that omits the linear dependency in the predictor variables.
  • It does not rely on matrix multiplication and inversion of the raw values, which are thought to cause numeric overflows in many computer systems and consequent inaccuracies in the results. QR decomposition does involve matrix manipulation, but the input values are adjusted beforehand to reduce the likelihood of overflows that can cause inaccurate results.

Because this is intended to be a short paper, I will not get into the particulars of QR decomposition here, except to note that it usually involves the replacement of the observed X values with either zeros or with sums of squares. Matrix operations are still involved but there is much less opportunity for them to cause numeric overflows. The benefits therefore include more precise results and intermediate calculations that are not derailed by negative sums of squares and by determinants that equal zero.

Figures 3 and 4 repeat the data sets used in Figures 1 and 2, with the LINEST() results that are returned in Excel 2003 through Excel 2010.

Figure 3 The LINEST() regression equation returns non-zero standard errors—with one exception.

Figure 4 LINEST() returns numeric results rather than a matrix of error values.

Notice in both Figure 3 and Figure 4 that one of the variables has a zero value both for the regression coefficient (cell B9 in both figures) and for its standard error (cell B10 in both figures). This is Excel's way of communicating to the user that, in these cases, it regards the X(1) variable in both cases as contributing no unique information in the estimation of Y.

Therefore, LINEST() assigns X(1) a regression coefficient of 0.0, which is tantamount to removing X(1) from the regression equation:

Ŷ = -7.586 + 0.0 * X(1) + 1.480 * X(2)

When you multiply X(1) by zero for all records, X(1) has dropped out of the equation. If X(1) is completely dependent on X(1)—or vice versa—then the information in one of the variables is completely redundant and one of them should be omitted from the equation.

The variables X(1) and X(2) are perfectly dependent on one another. X(2) is just X(1) minus 1 – or, if you prefer, X(1) is just X(2) plus 1. Therefore, X(1) cannot provide any information about Y, once the information in Y attributable to X(2) has been accounted for.

Notice, by the way, that the omission of one of the X variables is reflected in the degrees of freedom (df) for the residual, in cell B12 in both Figure 3 and Figure 4. The df residual is the number of cases less the number of predictor variables. There are five cases, one each in rows 2 through 6. After omitting one of the dependent X variables, there is one X variable left on the worksheet. Because the third argument to LINEST() has been omitted—the same as setting it to TRUE—Excel automatically supplies a column of 1's to represent the constant. So, 5 cases less the X variable remaining on the worksheet, less the unseen column of 1's to represent the constant leaves 3 degrees of freedom, as reported by LINEST().

A Difficult Diagnosis

The dependency in the X variables need not be restricted to two of the variables, such as the case in which variable X(2) is the result of multiplying variable X(1) by a constant. In that sort of situation, a simple correlation analysis reveals the dependency. See Figure 5.

Figure 5 The dependency is clear from the correlation matrix in B9:D11, particularly cell B10, but not from B23:D25.

In Figure 5, the correlation between B2:B6 and C2:C6 is both perfect and obvious from the correlation matrix in B9:D11. X(2) is simply twice X(1).

But there is no zero-order correlation of 1.0 in the data shown in B16:D20; there is no correlation of 1.0 in the matrix shown in B23:D25. Here, X(3) is the sum of X(1) and X(2). There is no perfect correlation between any of the individual variables, but there is perfect linear dependency between X(3) and {X(1) and X(2)}, as is shown in cells G23 and G25. To determine that the dependency exists without running LINEST(), you would have to check for a valid determinant of the SSCP matrix.

No Warning

This is all sensible and it's the approach taken by the major statistical applications such as SAS, SPSS, and R.

However, those packages go a step further and alert the user with a message to the effect that there is complete linear dependency in the underlying data, and that one or more variables have been removed from the equation. This is considerate. Excel provides the user with no warning along those lines, apart from zero-valued regression coefficients and standard errors.

Without knowledge of what Excel might do if it encounters this sort of linear dependency, the user might not understand the reason that one of the variables' regression coefficients is 0.0, that its standard error is given as 0.0, and that the df for the residual has in consequence been increased by 1.

Of course, LINEST() is a worksheet function and as such is expected to return results, not warnings in the form of text messages. However, it would be consistent with the behavior of other Excel worksheet functions if LINEST() were to return a value such as #NUM! or #N/A! when QR decomposition reveals linear dependency among the X variables.

Furthermore, TREND() uses the same approach to calculating the regression equation as does LINEST(). But nowhere in the TREND() results is it apparent that a variable has been omitted from the regression equation. Granted, a user should always arrange for and examine the results returned by LINEST() before uncritically accepting the results of LINEST(). Nevertheless, TREND() is accompanied by no warning at all that something unexpected might have occurred.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020