Programming the statistical procedures from SAS

Help to fit this model with NLMIXED

New Contributor
Posts: 2

Help to fit this model with NLMIXED

Hello everyone,


I am trying to use SAS (SAS University Edition) to fit a nonlinear mixed-effects model to my data. Before fitting the model, I first import the data into SAS. This data consists in repeated measurements (over time) for a group of individuals (the dataset is attached). To distinguish between individuals, I use a grouping variable grp. This dataset is not a 'synthetic dataset' (ie. the data was not generated using the model itself or another model).


Here is the code to import the data :


filename mydata '/folders/myfolders/data_for_nlmixed_procedure.txt';

data datagen;
infile mydata delimiter=',';
input X Y grp;


Once the data is imported into SAS, here is the code I use (and the model I want to fit to my data) :


proc nlmixed data=datagen tech=quanew linesearch=6 method=gauss qpoints=1 maxfunc=100000 maxiter=6000;
parms p0=1.33301 t0=71.7015 v0=-0.0002 s2gamma=0.48836 s2tau=40.5372 s2e=0.02251;
model Y ~ normal( p0 + exp(gamma)*v0*(X-t0-tau) , s2e);
random gamma tau ~ normal([0, 0], [s2gamma, 0, s2tau]) subject=grp out=eb_rh_insula;


When using this code, I often encounter the following error : "No valid parameter points were found". For example, this happens by choosing as initial values : p0=3.33 t0=51 v0=-0.002 s2gamma=0.48 s2tau=40 s2e=0.02. To deal with this error message, I assumed I had to try different starting values. Once I found correct starting values, the procedure NLMIXED often has difficulties to converge. For example, running the code above gives me :


ERROR: QUANEW Optimization cannot be completed.
NOTE: The gradient of the objective function cannot be computed during the optimization process.
I have tried other optimization techniques (tech=newrap, trureg,...) but I keep getting error messages. 

I would like to understand what is causing these difficulties. Is it a problem with the model itself ? I believe the model is identifiable. Is it a problem with my NLMIXED procedure ? I would really appreciate new ideas here !
Thank you !
Respected Advisor
Posts: 4,606

Re: Help to fit this model with NLMIXED

I'm no expert with nlmixed but one thing that sure helps is to remove subjects without enough points. I think the difficulty might be with the product of gamma and tau, both being random. Anyway, this takes a while but converges...


proc sql;
create table b as
select *
from datagen
group by grp
having count(*) >= 3;

proc nlmixed data=b tech=quanew qpoints=8;
parms p0=2.5 t0=71.7015 v0=-8.5 s2gamma=6 s2tau=40.5372 s2e=0.02251;
model Y ~ normal( p0 - exp(gamma)*(X-tau) , s2e);
random gamma tau ~ normal([v0, t0], [s2gamma, 0, s2tau]) subject=grp;
New Contributor
Posts: 2

Re: Help to fit this model with NLMIXED

Thank you for your answer ! I will try this new code.


I am interested in having several points of view on the model or the NLMIXED procedure. This would probably help me understand where are the difficulties coming from when fitting the model to some data.

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation