August 28th, 2004, 7:26 pm
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!!!