Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trouble with charts in Excel 2007 - Access 2007/VBA | Excel Programming | |||
Pasting a chart from Excel 2007 to Word 2007 trouble | Charts and Charting in Excel | |||
Excel 2007 SP1 TROUBLE | Excel Discussion (Misc queries) | |||
Trouble printing JPG in Excel 2007 | Excel Discussion (Misc queries) | |||
Trouble with Titles - Excel 2007 | Excel Discussion (Misc queries) |