Programming the statistical procedures from SAS

Large Gradient Values for PROC NLMIXED

Reply
Occasional Contributor
Posts: 5

Large Gradient Values for PROC NLMIXED

Hi All,

 

I am running a nlimixed procedure in the code below but getting large Gradient values. Any tip to address it is really appreciated.

 

SAS Code:

 

title"NLMIXED model";
proc nlmixed data=library.projectfulldata ;
parms intercept=0 s0=1 b_age=0 b_gender=0 b_NUMGO=0 b_meandelay=0 b_meanrt=0 b_ADHD1=0 b_OCD1=0 b_ASD1=0 b_ADHDOCD1=0 b_ADHDASD1=0 b_stoperror1=0 b_goerror1=0 b_noresponse1=0 b_prepush1=0 b_stopcorrect1=0;
eta=exp (intercept+ (b_age)*age+(b_gender)*gender+ (b_NUMGO)*NUMGO+(b_meandelay)*meandelay+ (b_meanrt)*meanrt+(b_ADHD1)*ADHD1+(b_OCD1)*OCD1 +(b_ASD1)*ASD1 +(b_ADHDOCD1)*ADHDOCD1 +(b_ADHDASD1)*ADHDASD1 +(b_stoperror1)*stoperror1+(b_goerror1)*goerror1 +(b_noresponse1)*noresponse1 +(b_prepush1)*prepush1 +(b_stopcorrect1)*stopcorrect1 + u0);
p=eta/(1+eta);
model stopcorrect~binary(p);
random u0~N(0,s0) subject=id ;
run;

 

SAS OUTPUT:

 

SAS Output

Specifications
Data SetLIBRARY.PROJECTFULLDATA
Dependent Variablestopcorrect
Distribution for Dependent VariableBinary
Random Effectsu0
Distribution for Random EffectsNormal
Subject Variableid
Optimization TechniqueDual Quasi-Newton
Integration MethodAdaptive Gaussian Quadrature

Dimensions
Observations Used327309
Observations Not Used0
Total Observations327309
Subjects13696
Max Obs per Subject24
Parameters17
Quadrature Points3

 

 

 

Parameter Estimates Parameter Estimate Standard Error DF t Value Pr > |t| Alpha Lower Upper Gradient 
0.0071910.0349314E30.210.83690.05-0.061270.07565-1933.22
-111E-140.00304114E3-0.001.00000.05-0.005960.0059613464.237
-0.033990.00158114E3-21.50<.00010.05-0.03709-0.03089-39226.8
0.015300.00730214E32.100.03610.050.0009920.02962-3119.54
-0.063480.00145114E3-43.76<.00010.05-0.06632-0.06064-21301.3
0.0019290.00002414E380.07<.00010.050.0018820.001976611828.1
0.0001600.00004214E33.840.00010.050.0000780.000242-168051
-0.003970.0159914E3-0.250.80370.05-0.035320.02737-77.9574
-0.000320.0543414E3-0.010.99530.05-0.10680.1062-29.3978
-0.001510.0394314E3-0.040.96950.05-0.078800.0757816.8127
-0.000660.0622414E3-0.010.99150.05-0.12270.1213-8.02057
0.0012010.0685914E30.020.98600.05-0.13330.1357-49.1149
0.50160.0137814E336.39<.00010.050.47460.5286906.2667
-0.24350.0185714E3-13.11<.00010.05-0.2799-0.2071327.0716
-0.075380.0307414E3-2.450.01420.05-0.1356-0.01513314.5398
-0.056880.0459014E3-1.240.21530.05-0.14690.03310251.5092
0.12920.0129114E310.01<.00010.050.10390.1545-522.615
Super Contributor
Posts: 490

Re: Large Gradient Values for PROC NLMIXED

A large gradient suggests the parameter estimate is not located at the minimum and, thus, could be changed to produce a better model fit. If any gradient is much above 0.001, one should adjust the initial parameter estimates and rerun the program.

Occasional Contributor
Posts: 5

Re: Large Gradient Values for PROC NLMIXED

Thanks Mohamed !

 

To change initial values for the parameters in the SAS code which values are preferable ?

 

For example, if we use the current SAS output  coefficient values as the initial parameter values for the modified SAS code , will it be OK ? or generally, its try and error ?

SAS Super FREQ
Posts: 3,547

Re: Large Gradient Values for PROC NLMIXED

For your specific case, this looks like it might be a logistic regression with a random-effects term added. In that situation, I would use PROC LOGISTIC to fit a fixed-effects model, then use those estimates as the initial estimates of the random-effects model.

Occasional Contributor
Posts: 5

Re: Large Gradient Values for PROC NLMIXED

Thank You Rick !    Will try it. 

Respected Advisor
Posts: 2,655

Re: Large Gradient Values for PROC NLMIXED

And I would fit it all in GLIMMIX, rather than doing the two step LOGISTIC followed by NLMIXED.  I don't see anything in the NLMIXED code that couldn't be easily ported over to GLIMMIX.  There is only a single subject level random effect being modeled as an additive term in the logit.

 

Steve Denham

Ask a Question
Discussion stats
  • 5 replies
  • 379 views
  • 3 likes
  • 4 in conversation