BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ukhan
Obsidian | Level 7

Hello,

I am trying to estimate six different parameters from my data using the following PROC, but the 95% CI of one parameter is too large (Parameter T). When I fixed “parameter A” with its estimated value in the second round, the 95% CI of “parameter T” also gets reduced. How can I fix this issue without fixing “parameter A”? Output SAS results are provided as a PDF attachment. Many thanks for the help

 

proc nlin data=exp method=marquardt;
parms RLTE=0.00132 B=0.5 C=0.8 A=0.08 T=3 TU=20;

R=RLTE*predlcm**C*EXP(A*temp)*(1-EXP(T*(temp-TU)));
s=sow**(1-B)-R*(1-B)*time;
if s>0 then stx=s**(1/(1-B));
else stx=0;

model stw=stx;

output out=expp p=pstw r=stw_residual;
run;
proc summary data=expp;
     var stw_residual stw;
     output out=stats css(stw)=sstot uss(stw_residual)=ssres N=N;
run;
data expp;
     set stats;
     rsquared=1-(ssres/sstot);
     adjrsquared = 1-(1-rsquared)*(N-1) / (N- 4  -1);
run;
proc print data=expp;
run; 
1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Just looking through the correlation matrix, I get the feeling that T and TU are capturing the same information, especially after A settles in during the iterations. Is it possible that the two are linearly related somehow?  Is there a possible re-parameterization or rescaling that might help?  

 

Another thing to check is whether this is method dependent.  For instance, try method=Newton.

SteveDenham

View solution in original post

10 REPLIES 10
Rick_SAS
SAS Super FREQ

Can you explain why you think the CI for T is "too large"? How are you making that determination?

ukhan
Obsidian | Level 7

Thanks for the comments. The 95% CI estimated for T is unrealistic as it should not be this much large. But its 95% CI reduced to the acceptable range after fixing the parameter A with 0.08. 

Rick_SAS
SAS Super FREQ

I don't have your data, so it is impossible to assess whether the CI for T is too large or not.  You could use a bootstrap analysis to see if the bootstrap CI (based on percentiles) is similar to the CI you are obtaining from PROC NLIN.

 

When I look at the code, I think the following line looks suspicious:

if s>0 then stx=s**(1/(1-B));
else stx=0;

I don't know what this statement is trying to accomplish, but consider whether 
ELSE stx=.;
might be more appropriate.

 

Good luck.

ukhan
Obsidian | Level 7

I used ELSE stx=.; but got this error:  ERROR: The ELSE statement does not have a matching IF statement at line 91 column 1.
Dear Rick, please kindly check the below link to download the data and PRCO codes. Many thanks for the help. 

 

https://drive.google.com/drive/folders/1nrYBtTuYrvV3Ykr9tro9FlqTyjRmkf2e?usp=sharing 

SteveDenham
Jade | Level 19

Just looking through the correlation matrix, I get the feeling that T and TU are capturing the same information, especially after A settles in during the iterations. Is it possible that the two are linearly related somehow?  Is there a possible re-parameterization or rescaling that might help?  

 

Another thing to check is whether this is method dependent.  For instance, try method=Newton.

SteveDenham

ukhan
Obsidian | Level 7

Dear Steve,
Thanks for the hints. Yes, the 95% CI of T and TU considerably get narrow with method=Newton. Could we further reduce the 95% CI? Many thanks for the hints.
Respectfully,

SteveDenham
Jade | Level 19

Maybe ridging will help, but to do it requires switching to NLMIXED.  Since I don't have access to the exp dataset, I haven't gone through this for any errors or odd behavior:

 

proc nlmixed data=exp technique=nrridg;
parms RLTE=0.00132 B=0.5 C=0.8 A=0.08 T=3 TU=20 s2e=0.1;
R=RLTE*predlcm**C*EXP(A*temp)*(1-EXP(T*(temp-TU)));
s=sow**(1-B)-R*(1-B)*time;
if s>0 then stx=s**(1/(1-B));
else stx=0;
   model stw ~ normal(stx,s2e);
run;

I assume the variables 'sow' and 'predlcm' are in the 'exp' dataset.  What concerns me a bit about it is the units for all of these. R should have units of RLTE*predclm, so 'sow' should have units like RLTE*predclm*time.  The issue is that sow is exponentiated, and so has to accommodate that.  It looks like the definition of 'stx' handles that with the exponentiation there equal to the reciprocal of the first term in the definition of 's'.  So now we have to deal with the second term in the definition of s after exponentiation.  I don't see how to make that rather complicated expression unitless, so that the units of 'stx' aren't some horrible mixture of things.  I presume this equation is standard in the literature for the digestive physiology of fish, or you wouldn't have chosen it.  I just think some rearranging of terms or something should help with the correlation which is responsible for the extended confidence interval.

 

SteveDenham

 

ukhan
Obsidian | Level 7

Dear Steve,
I used your codes, but got the following error.

WARNING: The final Hessian matrix is full rank but has at least one negative eigenvalue. Second-order optimality condition violated.

 

Could you please check this link to get exp dataset https://drive.google.com/drive/folders/1nrYBtTuYrvV3Ykr9tro9FlqTyjRmkf2e?usp=sharing 

ukhan
Obsidian | Level 7
Dear Steve,
Could you please help me in understanding why "Method: Newton" better perform than "Method: Marquardt" in my case? I would be grateful if you could briefly explain it.
SteveDenham
Jade | Level 19

I am going to assume you have no background in numerical analysis, and in particular,numeric minimization.. The Marquardt method can be much more sensitive to the initial conditions than the Newton method.  So what, you say?  It means that if there are multiple minima for the function in question, that your initial parameter guesses had better be close to the values at the global minimum.  If not, then you could converge to a set of values that result in a larger error term.  The other issue that Newton's method is a bit better at handling highly correlated parameters, such as those you have here.  Does that help at all?

 

SteveDenham

 

PS.  There are some reasons that other optimizers are available while Marquardt's is not for other optimization-based procedures, but that is material I have not dealt with since graduate school, so I am liable to end up with completely wrong responses. You might get better answers if you posted the question in the Mathematical Optimization forum.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 10 replies
  • 2389 views
  • 3 likes
  • 3 in conversation