Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I need to do a polynomial regression, 5th order. I think I am using the right formula: application.linest(x,y^{1,2,3,4,5}) My problem is that {} is not accepted! Invalid character. I am using excel 2000. What can I do to fix this problem? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA doesn't accept { } character, so I can not write this formula!
If x & y are range names for your data, this is one way. The highest order polynomial coefficient is index 1. Sub Demo() Dim M M = [Linest(y,x^{1,2,3,4,5})] End Sub = = = HTH :) Dana DeLouis Lucile wrote: I already tried that. VBA doesn't accept { } character, so I can not write this formula! But thanks for the help! "Gary''s Student" wrote: Follow: http://spreadsheetpage.com/index.php...line_formulas/ Consider using VBA to place the formulas in worksheet cells or use EVALUATE() to evaluate then directly. -- Gary''s Student - gsnu200825 "Lucile" wrote: Hello, I need to do a polynomial regression, 5th order. I think I am using the right formula: application.linest(x,y^{1,2,3,4,5}) My problem is that {} is not accepted! Invalid character. I am using excel 2000. What can I do to fix this problem? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks everybody fro your help... But it is not working!
First I know that a 5th order polynomial regression is too much, but it is what I have to do for now. And with a 3rd order I will have the same problem... I tried evaluate... But what I understand is I have to define my range and not only put a range name... I tried: lastrow = Cells(Rows.Count, 1).End(xlUp).Row x = Range(Cells(2, 1), Cells(lastrow, 1)) y = Range(Cells(2, 7), Cells(lastrow, 7)) M = [linest(y,x^{1,2,3,4,5})] ActiveCell = M --- It gives me #NAME? And: lastrow = Cells(Rows.Count, 1).End(xlUp).Row x = Range(Cells(2, 1), Cells(lastrow, 1)) y = Range(Cells(2, 7), Cells(lastrow, 7)) a=application.index(application.linest(y,x^{1,2,3, 4,5}),1) --- It gives invalid character for { } I really need to find a way to do that! Thanks! "Mike Middleton" wrote: Lucile - (1) I suggest that you think seriously about whether you have data that should be analyzed using a 5th order polynomial. Use google to search for "regression overfit" (without the quote marks). (2) The correct order of the arguments for LINEST is known_y first and known_x second. It's the known_x data that are raised to the various powers. (3) Show the VBA code you are using. One approach is to use FormulaArray and build the arguments as concatenated text strings, in which case the curly brackets are part of a text string enclosed in double-quote marks. - Mike Middleton http://www.MikeMiddleton.com Excel Add-ins and Books for Data Analysis and Decision Analysis "Lucile" wrote in message ... Hello, I need to do a polynomial regression, 5th order. I think I am using the right formula: application.linest(x,y^{1,2,3,4,5}) My problem is that {} is not accepted! Invalid character. I am using excel 2000. What can I do to fix this problem? Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, I solve my problem!
Application.LinEst(y, Application.Power(x, Array(1, 2, 3, 4, 5)), True, True) Thaks all |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA doesn't accept { } character, so I can not write this formula!
Hi. Glad you got it working. ;) Just to add to your library...this is what I meant by a named Range... Sub Demo() Dim NRows As Long Dim M NRows = Cells(Rows.Count, 1).End(xlUp).Row - 2 + 1 With ActiveWorkbook.Names .Add "x", Cells(2, 1).Resize(NRows) .Add "y", Cells(2, 7).Resize(NRows) End With M = [Linest(y,x^{1,2,3,4,5})] 'Horizontal [I2].Resize(1, 6) = M 'or Verticle [I4].Resize(6) = WorksheetFunction.Transpose(M) End Sub = = = HTH Dana DeLouis Lucile wrote: Ok, I solve my problem! Application.LinEst(y, Application.Power(x, Array(1, 2, 3, 4, 5)), True, True) Thaks all |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
polynomial regression | Excel Programming | |||
Polynomial Regression with Dates | Excel Discussion (Misc queries) | |||
Polynomial Regression with Dates | New Users to Excel | |||
how to get coefficients for Polynomial regression as for rgp() | Excel Worksheet Functions | |||
example of a polynomial regression analysis | Excel Programming |