+ Reply to Thread
Results 1 to 7 of 7

Multiple linear regression without intercept

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    3

    Multiple linear regression without intercept

    Hello!

    How do I do a multiple linear regression without intercept. I've got 2 independent variables and 1 dependent, and I'd like use regression on my data to create a linear function passing through origin. (Excel 2011, I've got access to both PC and Mac)

    Thanks

    /Gustav

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Multiple linear regression without intercept

    LINEST does not have a function to force the trend through the origin. This problem can be solved using solver. It works on the principle of minimizing the sum of the squares of the differences between observed and desired values.

    In the attached spreadsheet, Columns A & B are the observed results.

    Column C has the formula =$H$1*A2+$H$2 (Y = mx+b). Where H1 is the slope and H2 is the intercept.
    Column D is the difference =B2-C2
    Column E is the square of the difference =D2^2

    Cell H3 contains the sum of the squares of the difference.

    Solver is an add-in that comes with Excel, but it must be "activated" - do a web search on how to do that. Solver causes some overhead, so you may want to turn it off when you don't need it.

    The set up for this problem is shown in the picture: Minimize Cell H3 (sum of the squares of the differences) by changing cells H1 (slope) and H2 (intercept) with the constraint that H2 is held at zero.

    You can use solver and this method to find the coefficients of any function. I've used it with mx + b + c*sin(dt +e).
    Attached Images Attached Images
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,809

    Re: Multiple linear regression without intercept

    dflak's response has me wondering if I am misunderstanding the question. According to the help file for the LINEST() function (https://support.office.com/en-us/art...a-fa7abf772b6d ), the third, optional [const] argument allows you to specify whether b should be 0 or calculated normally, and that applies to multiple regression applications, too. I have frequently used =LINEST(known-y's,known-x's,FALSE) to force b in my regressions to be 0.

    Perhaps I am not understanding what it means to do a linear regression without the intercept. If "without the intercept" is equivalent to "b=0", then specifying the [const] argument as FALSE should do what you are asking.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Multiple linear regression without intercept

    MrShorty, You are correct. LINEST does have a b=0 option. It's been a while since I've read the actual documentation and probably have it confused with something else.

  5. #5
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Multiple linear regression without intercept

    Thank you very much! Yes MrShorty, when I say "without intercept" i mean "b=0".

    However, when I use the formula I just get one number back in the cell I entered the formula. I write "=LINEST(C2:C655,A2:B655,FALSE,TRUE)" but that just gives me back one number in the cell I just entered the formula. According to the help file, (https://support.office.com/en-us/art...a-fa7abf772b6d) I should get the function and several regression statistics. How do I enable this and make it possible to see the results?

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,809

    Re: Multiple linear regression without intercept

    Which cells did you select as you entered the LINEST() function? It sounds like you only selected one cell, so you will only get the one result. In order to get all the coefficients, you need to select a horizontal array of cells. Did you confirm with ctrl-shift-enter (like all good array formulas)? If you want to output the additional statistics, you need to enter TRUE for the 4th argument, and select a 2D array of cells before entering the function and confirm with ctrl-shift-enter.

  7. #7
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    3

    Re: Multiple linear regression without intercept

    Yeah, I just had to select and create array formulas.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 13
    Last Post: 02-19-2019, 10:33 AM
  2. Multiple Linear Regression
    By BKB2003 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-11-2014, 10:03 AM
  3. Replies: 4
    Last Post: 02-10-2014, 04:37 AM
  4. Linear Regression by set Slope (not intercept)
    By Ben in forum Excel General
    Replies: 5
    Last Post: 05-21-2006, 05:55 AM
  5. Replies: 1
    Last Post: 05-15-2006, 06:55 AM
  6. Excel Linear Regression by set slope (not intercept)
    By Ben in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2006, 06:55 AM
  7. how do i graph multiple linear regression?
    By enortirol in forum Excel General
    Replies: 0
    Last Post: 02-21-2006, 09:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1