BookmarkSubscribeRSS Feed
jibounet01
Calcite | Level 5

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;
run;

 

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;
run;

 

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 !
2 REPLIES 2
PGStats
Opal | Level 21

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;
quit;

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;
run;
PG
jibounet01
Calcite | Level 5

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 3227 views
  • 0 likes
  • 2 in conversation