Page 1 of 1

VBA problem with LinEst Function

Posted: August 28th, 2004, 7:26 pm
by RS26
Hi,I'm trying to do a linear regression in VBA on 9 variables (trying to implement Longstaff& Schwartz LSM method for swaptions). with the following piece of code on 400 observationsPrivate Function olsResult(nb As Integer) As VariantReDim ols(10) As Variant Set Y = Range(Cells(8, 12), Cells(nb + 7, 12)) Set X = Range(Cells(8, 13), Cells(nb + 7, 21)) ols = Application.WorksheetFunction.LinEst(Y, X, True) 'Estimation MCOolsResult = olsEnd FunctionIt seems I have some memory problems as I don't get results for 9 variables, but the code seems to run smoothly with 5.Has anyone already used this function? are there any memory Limitations or my code is wrong?Thanks a lot for your help. Any advice would be great!!!

VBA problem with LinEst Function

Posted: September 10th, 2004, 7:18 am
by spursfan
better to see if it works in a spreadsheet first - chack carefully the output dimensions before you enter the formula then remember Ctrl+Shift+Enter