11-06-2012 04:36 PM
Are there guidelines for improving the performance of NLIN, which I am using to fit a linear model subject to inequality constraints, or is PROC SEM a better option? I found bheinsius's postings from June regarding NLIN performance, but the issue in that case was evidently capturing data rather than in executing the procedure. Since PROC NLIN is calculating the derivatives, I do not believe the documentation's note regarding the line "if _model_ then return;" is relevant for my situation (and it hasn't led to any improvement).
My syntax follows below, and the input dataset "test" contains 434,286 observations and 199 variables (of which only three are being used; nlin does not have a var statement like sem). The row count is after the "where=" option in the "proc nlin" statement. As the log at the bottom indicates, this procedure takes over six minutes in SAS Release 9.1 TS1M3 on a WIN_NTSV server. Paring the parameter ranges for b1 and b2 to 2.4-2.6 reduces the grid search time to only 13 seconds, but I only know how narrow to make the ranges for a second run after seeing the coefficients from the first run. The R library "penalized" is able to return the same model in under two seconds clock time on my desktop PC, which makes me think I have been clumsy/naive in my coding. Thank you in advance!
proc nlin data=test(where=(totAllowed <= 1500000));
a1 = 5
b1 = 2 to 3.5 by 0.1
b2 = 2 to 3.5 by 0.1
+ b1 * wra1
+ b2 * wra2
a1 >= 0
,b1 >= 0
,b2 >= 0
The log includes the following notes after the proceedure:
NOTE: DER.a1 not initialized or missing. It will be computed automatically.
NOTE: DER.b1 not initialized or missing. It will be computed automatically.
NOTE: DER.b2 not initialized or missing. It will be computed automatically.
NOTE: PROCEDURE NLIN used (Total process time):
real time 6:54.88
cpu time 3:37.21
3 The SAS System 10:19 Tuesday, November 6, 2012
NOTE: PROC NLIN grid search time was 0: 6:50.
NOTE: Convergence criterion met.