+ Reply to Thread
Results 1 to 10 of 10

Regression formula

  1. #1
    Registered User
    Join Date
    09-21-2010
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    36

    Cool Regression formula

    I often use regression in data analysis and produce relevant graph.
    Here's the code:

    Please Login or Register  to view this content.
    As you can see I've tried to "catch" automatically in some way the formula given by the trendlines in the graph area in order to use it for other calculations, but unsuccessful.
    Have you any hint on how this can be achieved?
    Thanks in advance for your usual precious help.
    Last edited by Romoluzzi; 01-02-2011 at 09:46 AM.

  2. #2
    Registered User
    Join Date
    09-21-2010
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Regression formula

    No suggestions? not even for the new year?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regression formula

    You can use LINEST to get the parameters of the regression.

    If you post a workbook with an example, I or someone else will show you how.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,254

    Re: Regression formula

    Does the link below help in resolving your desire?

    http://zimmer.csufresno.edu/~davidz/...INESTfull.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    09-21-2010
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Regression formula

    Here's is another evidence that (almost) always the simplest solution is the hardest to find out..... I hadn't thought about using Excel's LINEST function, my fault.
    But at this point I have another question: is there any way to use the 10 parameters generated by LINEST in VBA code? In other words, is it possible in a macro / UDF to set a variable to get the value of the slope, the intercept, etc and to use it in further calculations, WITHOUT actually inputting the array formula in a ten-cell area of the worksheet and/or WITHOUT set the calculation in the VBA procedure?
    For example, if I use the macro recorder and input the LINEST formula in the worksheet, I get:

    Please Login or Register  to view this content.
    I see that there is a VBA instruction to calculate the parameters; is it possible to put some of the 10 values DIRECTLY in variables WITHOUT using the corresponding cells values in the worksheet?

    I hope my question is clear and I thank you all for your support.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Regression formula

    Do you mean along the lines of:

    Please Login or Register  to view this content.
    vResults would be a 2d Array of the results.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regression formula

    Or

    Please Login or Register  to view this content.

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Regression formula

    oops... I do like to over engineer every now and then !

  9. #9
    Registered User
    Join Date
    09-21-2010
    Location
    Rome, Italy
    MS-Off Ver
    Excel 2003
    Posts
    36

    Thumbs up Re: Regression formula

    I wish to thank both DonkeyOte and shg for their valuable help.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regression formula

    I do like to over engineer every now and then !
    Well, maybe. The versatility of the Evaluate function is something that I continue to enjoy seeing good examples of, as here, and you provide great examples. Among other things (if not in this specific case), Evaluate permits the use of the literal arrays that are so convenient in formulas.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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