memory leakage and FIND
Posted: Tue Jul 24, 2012 1:58 pm
I want to evaluate the forecast accuracy of models that are used to construct portfolios weights (think mean-variance). Accuracy is measured using utility functions of ex-post gross returns on the investment (mean-variance, power, etc.). Forecasts are constructed recursively. That last part matters below.
More precisely, I am running a program designed to evaluate the actual size properties of a block bootstrap approach to inference on the "usefulness" of a competing model. To do this I am running a simulation of a block bootstrap. The statistic used to evaluate accuracy is the root of a function. This function is essentially the difference in the average out-of-sample utilities associated with the two investing strategies. In earlier sims the root had a closed form and I used that closed form directly. That code ran - perhaps slower than I would like but the sims got done. I have modified the same code but now using a different utility function. The root now does not have a closed form.
I can think of two ways to solve for the root. One is to use FIND. When I do this the code is reasonably fast but devours memory - so much so that I cannot possibly run 50 reps of 499 bootstrap reps much less the 2000 reps of 499 bootstrap reps I want to run. The other approach is to do a direct grid search using a loop. This does not devour memory but I will be very very old indeed by the time these sims finish.
I am currently running version 7.3. I know version 8.x is out. I am not using it for a reason. The forecasts are all recursive. Do loops over linregs is dirt slow. Instead, a colleague gave me a procedure to speed that part up by an order of magnitude. However, I have not been able to get that procedure to work here at the StL Fed using version 8.x - but it does work on version 7.3.
Any help would be appreciated. I would prefer FIND to work rather than use my very simple grid search. The latter requires me to search over a "region" that I define. In this sim that region is centered around zero (size). in future sims I will not be so fortunate as to know where that region should be centered (power).
--Mike
More precisely, I am running a program designed to evaluate the actual size properties of a block bootstrap approach to inference on the "usefulness" of a competing model. To do this I am running a simulation of a block bootstrap. The statistic used to evaluate accuracy is the root of a function. This function is essentially the difference in the average out-of-sample utilities associated with the two investing strategies. In earlier sims the root had a closed form and I used that closed form directly. That code ran - perhaps slower than I would like but the sims got done. I have modified the same code but now using a different utility function. The root now does not have a closed form.
I can think of two ways to solve for the root. One is to use FIND. When I do this the code is reasonably fast but devours memory - so much so that I cannot possibly run 50 reps of 499 bootstrap reps much less the 2000 reps of 499 bootstrap reps I want to run. The other approach is to do a direct grid search using a loop. This does not devour memory but I will be very very old indeed by the time these sims finish.
I am currently running version 7.3. I know version 8.x is out. I am not using it for a reason. The forecasts are all recursive. Do loops over linregs is dirt slow. Instead, a colleague gave me a procedure to speed that part up by an order of magnitude. However, I have not been able to get that procedure to work here at the StL Fed using version 8.x - but it does work on version 7.3.
Any help would be appreciated. I would prefer FIND to work rather than use my very simple grid search. The latter requires me to search over a "region" that I define. In this sim that region is centered around zero (size). in future sims I will not be so fortunate as to know where that region should be centered (power).
--Mike