Serving the Quantitative Finance Community

 
User avatar
RS26
Topic Author
Posts: 0
Joined: May 6th, 2004, 8:12 am

VBA problem with LinEst Function

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!!!
 
User avatar
spursfan
Posts: 2
Joined: October 7th, 2001, 3:43 pm

VBA problem with LinEst Function

September 10th, 2004, 7:18 am

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