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;
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
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
Thank you for your response!
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?
> 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.
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?
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.