View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default polynomial regression

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