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

I would like to obtain the hessian and the gradients of my fixed effects in proc mixed. In proc glimmix I can obtain it with the code below, but I can not find how to have the equivalent my_gradient and my_hessian dataset in proc mixed. Due to characteristics of my model, I cannot use proc glimmix/proc nlmixed to fit my model instead of proc mixed. 

 

proc glimmix data=data GRADIENT HESSIAN SUBGRADIENT=my_gradient;
model response0(ref='1') = var /noint s dist=byobs(distvar) link=byobs(linkvar) covb solution;
random intercept time/type=un subject=surveyID;
ods output hessian=my_hessian ;
run;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
6 REPLIES 6
SteveDenham
Jade | Level 19

Well, I think you have a handle on it using GLIMMIX.  Check out @Rick_SAS 's blog post on ways to obtain the Hessian https://blogs.sas.com/content/iml/2019/02/13/hessian-maximum-likelihood-covariance.html#:~:text=Some...

 

If you have a different endpoint (continuous with normal errors), I think you can use a STORE statement in PROC MIXED, and then use the SHOW statement in PROC PLM to get the Hessian.  I don't see an equivalence for the gradient, though.

 

SteveDenham

mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

Thank you for your response! 

mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

It is possible to implement the model with  proc nlmixed, but reaching convergence is very time-consuming and maybe not possible. However, even without convergence SAS creates a dataset with the gradients. Are these values valid, even if the model did not reach convergence?

Rick_SAS
SAS Super FREQ

> Are these values valid, even if the model did not reach convergence?

 

Yes, they are "valid". The numbers are the gradient at the end of each iteration. Because PROC NLMIXED supports the BOUNDS statement, the final gradient might not be the zero vector. If the model does not converge, the final gradient might not be zero. 

 

For unconstrained linear regression, there is no reason to report the gradient because it is the zero vector at the solution.

mgx
Obsidian | Level 7 mgx
Obsidian | Level 7

Related to this question: in proc mixed you cannot get the hessian for the fixed effects estimates, only the variance-covariance matrix (the store statement gives the error that the model does not contain the hessian). What is the difference between the hessian en the variance-covariance matrixof the fixed effects?

Rick_SAS
SAS Super FREQ

The Hessian is the inverse of the covariance matrix of the fixed effects. See

https://blogs.sas.com/content/iml/2019/02/13/hessian-maximum-likelihood-covariance.html

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 6 replies
  • 1452 views
  • 1 like
  • 3 in conversation