Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having trouble using LINEST in Excel 2007 VBA

I'm trying to run regressions in VBA using the code

ols = Application.WorksheetFunction.LinEst(Y, x, True, True)

As I understand it the second TRUE generates the stats for the regression,
but I only get the coefficients. (It shows NA for the stats).

Help?!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Having trouble using LINEST in Excel 2007 VBA

In this usage of Linest I get the same in Excel and VBA, eg

Sub test2()
Dim i As Long
Dim Y(1 To 5) As Double
Dim x(1 To 5) As Double
Dim ols

For i = 1 To 5
Y(i) = 2 * (i ^ 2) + (3 * i) + 4
x(i) = i
Next

ols = Application.WorksheetFunction.LinEst(Y, x, True, True)
Range("G1:H5") = ols

Range("A1:A5") = Application.Transpose(x)
Range("B1:B5") = Application.Transpose(Y)
Range("D1:E5").FormulaArray = "=LINEST($B$1:$B$5,$A$1:$A$5,TRUE,TRUE)"

End Sub

Regards,
Peter T

"Chef Scottie" <Chef wrote in message
...
I'm trying to run regressions in VBA using the code

ols = Application.WorksheetFunction.LinEst(Y, x, True, True)

As I understand it the second TRUE generates the stats for the regression,
but I only get the coefficients. (It shows NA for the stats).

Help?!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with charts in Excel 2007 - Access 2007/VBA ragtopcaddy via OfficeKB.com Excel Programming 1 October 8th 08 07:25 PM
Pasting a chart from Excel 2007 to Word 2007 trouble Vegas Charts and Charting in Excel 5 September 16th 08 07:37 AM
Excel 2007 SP1 TROUBLE [email protected] Excel Discussion (Misc queries) 0 August 16th 08 06:19 PM
Trouble printing JPG in Excel 2007 Val Excel Discussion (Misc queries) 0 August 12th 08 02:21 PM
Trouble with Titles - Excel 2007 Brenda[_4_] Excel Discussion (Misc queries) 2 March 5th 08 04:06 AM


All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"